Solved

PL/SQL Anonymous Block error in Oracle Apex

Posted on 2010-09-16
3
1,405 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines

687 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