If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Oracle > PLS-00103 While Creating Trigger

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-14-11, 02:15
edwin_fredrick edwin_fredrick is offline
Registered User
 
Join Date: Oct 2004
Posts: 44
PLS-00103 While Creating Trigger

Hi

when i am trying to create the following trigger i am getting PLS-00103

<code>
create or replace
TRIGGER logon_audit
AFTER LOGON ON DATABASE
DECLARE sqlstr VARCHAR2(200) := 'alter session set "_optim_peek_user_binds"=false;';
BEGIN

BEGIN
IF (USER = 'SCOTT') THEN
execute immediate sqlstr;
END IF;

END logon_audit;
<code>


Error(12,16): PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following: begin case declare end exception exit for goto if loop mod null pragma raise return select update while with <an identifier> <a double-quoted delimited-identifier> <a bind variable> << close current delete fetch lock insert open rollback savepoint set sql execute commit forall merge pipe
Reply With Quote
  #2 (permalink)  
Old 11-14-11, 09:27
anacedent anacedent is offline
Registered User
 
Join Date: Aug 2003
Location: Where the Surf Meets the Turf @Del Mar, CA
Posts: 6,415
Code:
CREATE OR replace TRIGGER logon_audit
  after logon ON database
DECLARE
    sqlstr VARCHAR2(200) := 'alter session set "_optim_peek_user_binds"=false;';
BEGIN
    IF ( USER = 'SCOTT' ) THEN
      EXECUTE IMMEDIATE sqlstr;
    END IF;
END logon_audit;
__________________
You can lead some folks to knowledge, but you can not make them think.
The average person thinks he's above average!
For most folks, they don't know, what they don't know.
Reply With Quote
  #3 (permalink)  
Old 11-14-11, 14:03
Littlefoot Littlefoot is offline
Lost Boy
 
Join Date: Jan 2004
Location: Croatia, Europe
Posts: 3,629
Not really.

Although the ALTER SESSION statement looks OK, it is not. When used in EXECUTE IMMEDIATE, it shouldn't be terminated with a semi-colon.
Code:
No:
set "_optim_peek_user_binds"=false;';

Yes:
set "_optim_peek_user_binds"=false';
Reply With Quote
  #4 (permalink)  
Old 11-18-11, 00:25
edwin_fredrick edwin_fredrick is offline
Registered User
 
Join Date: Oct 2004
Posts: 44
Thanks Littlefoot
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On