Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the correct syntax to break a PL/SQL procedure call in multiple lines?

I am calling a PL/SQL procedure like this:

execute util.verify(src_schema => '&username',
                    stab       => '&tab_name');

and I get these errors:

SQL> execute util.verify(src_schema => '&username',
BEGIN util.verify(src_schema => 'u1',; END;

                                     *
ERROR at line 1:
ORA-06550: line 1, column 57: 
PLS-00103: Encountered the symbol ";" when expecting one of the following:
( - + case mod new not null <an identifier>
<a double-quoted delimited-identifier> <a bind variable>
continue avg count current exists max min prior sql stddev
sum variance execute forall merge time timestamp interval
date <a string literal with character set specification>
<a number> <a single-quoted SQL string> pipe
<an alternatively-quoted string literal with character set specification>
<an alternatively


SQL>                   stab       => '&tab_name',
SP2-0734: unknown command beginning "stab      ..." - rest of line ignored.

Looks like I cannot just break the call in between at a ,. How can I write this call in multiple lines?

like image 962
Moeb Avatar asked Dec 25 '10 07:12

Moeb


People also ask

How are multiline commands defined in PL SQL?

PL/SQL supports two comment styles: single-line and multi-line. A double hyphen ( - - ) anywhere on a line (except within a character literal) turns the rest of the line into a comment. Multi-line comments begin with a slash-asterisk ( /* ) and end with an asterisk-slash ( */ ).

Which one will use for multi-line comment in PL SQL?

PL/SQL supports two comment styles: single-line and multi-line. Single-line comments begin with a double hyphen ( - - ) anywhere on a line and extend to the end of the line. Multi-line comments begin with a slash-asterisk ( /* ), end with an asterisk-slash ( */ ), and can span multiple lines.

How do you break out of a for loop in PL SQL?

The EXIT statement breaks out of a loop. The EXIT statement has two forms: the unconditional EXIT and the conditional EXIT WHEN . With either form, you can name the loop to be exited.

Which keyword is used in PL SQL to terminate?

You should use EXIT WHEN statement to exit from the Loop.


1 Answers

In SQLPlus, you put a dash at the end of lines that continues on the next line.

execute util.verify(src_schema => '&username', -
                    stab       => '&tab_name');

Update: Added link to documentation

EXECUTE, SQL*Plus® User's Guide and Reference

like image 176
Ronnis Avatar answered Oct 28 '22 13:10

Ronnis