Solved

PL/SQL Anonymous Block error in Oracle Apex

Posted on 2010-09-16
3
1,396 Views
Last Modified: 2012-06-21
Hello experts:

I am running a pl/sql process in Oracle Apex and need to bind a variable :P1_READ_WRITE_AUTH

Running the sql process returns an error PLS-00103.

Can you please tell me what I am doing wrong? The query should at least run in a console or sql developer.

Many thanks,

skahlert2010


DECLARE
SCHREIBRECHT varchar2();
LESERECHT varchar2();
BEGIN
SCHREIBRECHT := 'Write Privileges';
LESERECHT := 'Read Only';
IF :F_READ_WRITE_AUTH = 'write' then 
:P1_READ_WRITE_AUTH := SCHREIBRECHT;
ELSIF :F_READ_WRITE_AUTH = 'read' then
:P1_READ_WRITE_AUTH := LESERECHT;
END IF;
END;

Open in new window

0
Comment
Question by:skahlert2010
3 Comments
 
LVL 28

Accepted Solution

by:
Naveen Kumar earned 500 total points
ID: 33690287
try :

DECLARE
SCHREIBRECHT varchar2();
LESERECHT varchar2();
BEGIN
SCHREIBRECHT := 'Write Privileges';
LESERECHT := 'Read Only';
IF F_READ_WRITE_AUTH = 'write' then
P1_READ_WRITE_AUTH := SCHREIBRECHT;
ELSIF F_READ_WRITE_AUTH = 'read' then
P1_READ_WRITE_AUTH := LESERECHT;
END IF;
END
0
 
LVL 7

Expert Comment

by:sumit2906
ID: 33690300
you need to specify the size fo variables you have declared, after this, if you are running it from sqlplus, you can declare other variables and this code should run fine.

var P1_READ_WRITE_AUTH varchar2(100);
var F_READ_WRITE_AUTH varchar2(100);

DECLARE  
SCHREIBRECHT varchar2(100);  
LESERECHT varchar2(100);  
BEGIN  
SCHREIBRECHT := 'Write Privileges';  
LESERECHT := 'Read Only';  
IF :F_READ_WRITE_AUTH = 'write' then  
:P1_READ_WRITE_AUTH := SCHREIBRECHT;  
ELSIF :F_READ_WRITE_AUTH = 'read' then  
:P1_READ_WRITE_AUTH := LESERECHT;  
END IF;  
END;
0
 

Author Closing Comment

by:skahlert2010
ID: 33690746
Thanks nav_kum_v! I was able to solve my problem. I didn't notice that my variable (an Apex Page Item) was already bound, as it didn't return the value when displayed! I modified the code to bind the item while returning the strings of the function!

Best regards,

Skahlert2010
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question