VastbaseG100

基于openGauss内核开发的企业级关系型数据库。

Menu

支持EXECUTE-USING语句

create table job(jobno int,jname varchar2(30));

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 $$;

vastbase=# select * from job;
 jobno |   jname   
-------+-----------
   300 | MANAGER
   400 | SALESMAN
   500 | PRESIDENT
(3 rows)