VastbaseG100

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

Menu

支持EXECUTE INTO USING 语句

DO $$ DECLARE
 v_sql VARCHAR2(60);
 v_jobno job.jobno%TYPE;
 v_jname job.jname%TYPE;
 r_job job%ROWTYPE;
BEGIN
 DBMS_OUTPUT.PUT_LINE('JOBNO JNAME');
 DBMS_OUTPUT.PUT_LINE('----- -------');
 v_sql := 'SELECT jobno, jname FROM job WHERE jobno = :p_jobno';
 EXECUTE  v_sql INTO v_jobno, v_jname USING 300;
 DBMS_OUTPUT.PUT_LINE(v_jobno || ' ' || v_jname);
 EXECUTE  v_sql INTO v_jobno, v_jname USING 400;
 DBMS_OUTPUT.PUT_LINE(v_jobno || ' ' || v_jname);
 EXECUTE  v_sql INTO r_job USING 500;
 DBMS_OUTPUT.PUT_LINE(r_job.jobno || ' ' || r_job.jname);
END $$;