SQL> create or replace procedure sp_pro3(name_in varchar2,id_in varchar2) is begin update mytest set name=name_in where id=id_in; end; / Procedure created SQL') PL/SQL procedure successfully completed SQL> select * from mytest; NAME PASSWD ID ------…
SQL> create or replace procedure sp_pro5(id_in varchar2) is v_sal mytest.salary%type; begin select salary into v_sal from mytest where id=id_in; then update mytest set salary=1.1*v_sal where id=id_in; end if; end; / Procedure created SQL); PL/SQL p…
1 PL/pgSQL Under the Hood This part discusses some implementation details that are frequently important for PL/pgSQL users to know. 1.1 Variable Substitution SQL statements and expressions within a PL/pgSQL function can refer to variables and paramet…
Cursors Rather than executing a whole query at once, it is possible to set up a cursor that encapsulates the query, and then read the query result a few rows at a time. A more interesting usage is to return a reference to a cursor that a function has…
1.Structure of PL/pgSQL The structure of PL/pgSQL is like below: [ <<label>> ] [ DECLARE declarations ] BEGIN statements END [ label ]; A label is only needed if you want to identify the block for use in an EXIT statement, or to qualify the na…