Wednesday 15 May 2013

plsql - Why does DECLARE exist if it is optional in PL/SQL stored procedures? -


I am told that I can leave the declared keyword in a declaration section of a stored procedure Is the declared keyword optional for the announcement code? If it is, then why is it present in everyone?

  is the process of creating or changing my process - start the announcement section DECLARE - DECLARE keyword is optional? Can I leave it here? Cursor MacCore as Selection ...; Var1 number; Var2 varchar2; - End of announcement section BEGIN ... myproc; The following is a syntax for creating a pl / sql process:    

The declaration of variables and cursors is on an essential basis and it is not mandatory. If you want to declare, then ignore the others:

  create [or change] process process_name [[parameter [, parameter]]] [announcement_action] BEGINexecutive_section [EXCEPTION exception_section] END [method_name];   

Also want to add that declaration declare is not used in the keyword process because the announcement block is contained.

Edit: Keyword is present for declaration in such cases where the declared block is not included. Let's say Anonymous Block, now you need to specify the declared block and there will be no place to declare the variable.

Syntax of Anonymous Block :

  Announcements & lt; Constant name & gt; Constant & lt; Data type & gt; : = & Lt; Price & gt ;; & Lt; Constant name & gt; Constant & lt; Data type & gt; Default & lt; Value & gt; BEGIN & lt; Valid Statement & gt ;; Exception & lt; Exception handler & gt; End;    

No comments:

Post a Comment