Ad Code

Responsive Advertisement

procedure in pl/sql.








Syntax of procedure :

CREATE OR REPLACE PROCEDURE 

 (
 
 ..
 .
 )
[ IS | AS ]
 
BEGIN
 
EXCEPTION
 
END;

Here we have a table of customer


SQL> select *from customer;

     AC_NO       B_NO NAME       CITY          BALANCE      COUNT CHK_DATE
---------- ---------- ---------- ---------- ---------- ---------- ---------
       111        101 biku       surat            7990          1 02-SEP-19
       112        103 sunil      vapi            11000          1 02-SEP-19
       113        102 balram     valsad          19000          3 01-JAN-19
       114        104 jenna      surat           18000          2 01-JAN-19
       115        105 sagar      mumbai           9000          1 01-JAN-19
       116        101 chirag     surat             800          3 01-JAN-19
       117        102 aditya     vapi              500          5 01-JAN-19
       118        103 rahul      valsad          14000          2 01-JAN-19
       119        103 bhavesh    mumbai           5000          1 01-JAN-19
       120        104 jay        surat             400          4 01-JAN-19
       121        105 bhola      vapi            11000          4 01-JAN-19

     AC_NO       B_NO NAME       CITY          BALANCE      COUNT CHK_DATE
---------- ---------- ---------- ---------- ---------- ---------- ---------
       122        101 sima       valsad           8000          2 01-JAN-19
       123        102 montu      surat            9000          2 01-JAN-19

13 rows selected.


Already we created a function in last tutorial So, we create a procedure :
 
create or replace procedure pro as
 m_name varchar2(10);
begin
 select get_name(111) into m_name from dual;
 dbms_output.put_line(m_name);
end;
/

Here, remember that the procedure always call by EXEC command. Result:
 
SQL> EXEC pro;
biku

PL/SQL procedure successfully completed.




If you like code with vibhu  and would like to contribute, you can also write an article using   This link :

https://docs.google.com/forms/d/e/1FAIpQLScAmvlPvNUz35R-G0nc_zpRVP3o8xlhtFgC3aKPyLetX_RyXg/viewform?pli=1


OR  mail your article to codewithvibhu@gmail.com.  See your article appearing on the code with vibhu main page and help other students. 
❮ Previous                                                      Next ❯

Post a Comment

0 Comments