VastbaseE100

基于开源技术的HTAP数据库管理系统。性能优异,稳定可靠,提供诸多专属领域特性。

Menu

支持EXECUTE-USING语句

DO $$ DECLARE
 v_sql VARCHAR2(50) := 'INSERT INTO job VALUES ' ||
 '(:p_jobno, :p_jname)';
 v_jobno job.jobno%TYPE;
 v_jname job.jname%TYPE;
BEGIN
 v_jobno := 300;
 v_jname := 'MANAGER';
 EXECUTE  v_sql USING v_jobno, v_jname;
 v_jobno := 400;
 v_jname := 'SALESMAN';
 EXECUTE  v_sql USING v_jobno, v_jname;
 v_jobno := 500;
 v_jname := 'PRESIDENT';
 EXECUTE  v_sql USING v_jobno, v_jname;
END $$;

atlasdb=# select * from job;
 jobno |   jname   
-------+-----------
 100   | ANALYST
 200   | CLERK
 300   | MANAGER
 400   | SALESMAN
 500   | PRESIDENT
(5 rows)