dbTalk Databases Forums  

IS and AS

comp.databases.oracle.tools comp.databases.oracle.tools


Discuss IS and AS in the comp.databases.oracle.tools forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
O_TEXT
 
Posts: n/a

Default IS and AS - 01-12-2009 , 10:01 AM






I was wondering what is the difference between IS and AS, in general
PL/SQL code.


For instance of FUNCTION book_t, how can oracle know if keyword ending
the header is IS or AS;
I mean if header returns SELF and declare result variable before BEGIN,
or if header returns SELF AS RESULT and declare nothing before BEGIN.


CREATE OR REPLACE TYPE BODY book_t
AS
CONSTRUCTOR FUNCTION book_t (id IN INTEGER,
title IN VARCHAR2,
isbn IN VARCHAR2,
pages IN INTEGER)
RETURN SELF AS RESULT
IS
BEGIN
SELF.id := id;
SELF.title := title;
SELF.isbn := isbn;
SELF.pages := pages;
IF isbn IS NULL OR SELF.ck_digit_okay
THEN
RETURN;
ELSE
RAISE_APPLICATION_ERROR(-20000, 'ISBN ' || isbn
Quote:
| ' has bad check digit');
END IF;
END;
....


Reply With Quote
  #2  
Old   
Michel Cadot
 
Posts: n/a

Default Re: IS and AS - 01-12-2009 , 10:08 AM







"O_TEXT" <O_TEXT (AT) nospam (DOT) fr> a écrit dans le message de news: gkfpg2$1187$1 (AT) biggoron (DOT) nerim.net...
Quote:
I was wondering what is the difference between IS and AS, in general
PL/SQL code.


For instance of FUNCTION book_t, how can oracle know if keyword ending
the header is IS or AS;
I mean if header returns SELF and declare result variable before BEGIN,
or if header returns SELF AS RESULT and declare nothing before BEGIN.


CREATE OR REPLACE TYPE BODY book_t
AS
CONSTRUCTOR FUNCTION book_t (id IN INTEGER,
title IN VARCHAR2,
isbn IN VARCHAR2,
pages IN INTEGER)
RETURN SELF AS RESULT
IS
BEGIN
SELF.id := id;
SELF.title := title;
SELF.isbn := isbn;
SELF.pages := pages;
IF isbn IS NULL OR SELF.ck_digit_okay
THEN
RETURN;
ELSE
RAISE_APPLICATION_ERROR(-20000, 'ISBN ' || isbn
|| ' has bad check digit');
END IF;
END;
...
one contains I and the other one A.

Regards
Michel




Reply With Quote
  #3  
Old   
Shakespeare
 
Posts: n/a

Default Re: IS and AS - 01-12-2009 , 10:19 AM



O_TEXT schreef:
Quote:
I was wondering what is the difference between IS and AS, in general
PL/SQL code.


For instance of FUNCTION book_t, how can oracle know if keyword ending
the header is IS or AS;
I mean if header returns SELF and declare result variable before BEGIN,
or if header returns SELF AS RESULT and declare nothing before BEGIN.


CREATE OR REPLACE TYPE BODY book_t
AS
CONSTRUCTOR FUNCTION book_t (id IN INTEGER,
title IN VARCHAR2,
isbn IN VARCHAR2,
pages IN INTEGER)
RETURN SELF AS RESULT
IS
BEGIN
SELF.id := id;
SELF.title := title;
SELF.isbn := isbn;
SELF.pages := pages;
IF isbn IS NULL OR SELF.ck_digit_okay
THEN
RETURN;
ELSE
RAISE_APPLICATION_ERROR(-20000, 'ISBN ' || isbn
|| ' has bad check digit');
END IF;
END;
...
It's all a matter of parsing....

Shakespeare

BTW: in many cases, AS and IS are interchangeable.


Reply With Quote
  #4  
Old   
O_TEXT
 
Posts: n/a

Default Re: IS and AS - 01-12-2009 , 11:04 AM



Shakespeare a écrit :
Quote:
O_TEXT schreef:
I was wondering what is the difference between IS and AS, in general
PL/SQL code.


For instance of FUNCTION book_t, how can oracle know if keyword ending
the header is IS or AS;
I mean if header returns SELF and declare result variable before BEGIN,
or if header returns SELF AS RESULT and declare nothing before BEGIN.


CREATE OR REPLACE TYPE BODY book_t
AS
CONSTRUCTOR FUNCTION book_t (id IN INTEGER,
title IN VARCHAR2,
isbn IN VARCHAR2,
pages IN INTEGER)
RETURN SELF AS RESULT
IS
BEGIN
SELF.id := id;
SELF.title := title;
SELF.isbn := isbn;
SELF.pages := pages;
IF isbn IS NULL OR SELF.ck_digit_okay
THEN
RETURN;
ELSE
RAISE_APPLICATION_ERROR(-20000, 'ISBN ' || isbn
|| ' has bad check digit');
END IF;
END;
...

It's all a matter of parsing....

Shakespeare

BTW: in many cases, AS and IS are interchangeable.
Is it possible to know on which rule PLSQL is based for parsing?





Reply With Quote
  #5  
Old   
Shakespeare
 
Posts: n/a

Default Re: IS and AS - 01-12-2009 , 12:15 PM



O_TEXT schreef:
Quote:
Shakespeare a écrit :
O_TEXT schreef:
I was wondering what is the difference between IS and AS, in general
PL/SQL code.


For instance of FUNCTION book_t, how can oracle know if keyword ending
the header is IS or AS;
I mean if header returns SELF and declare result variable before BEGIN,
or if header returns SELF AS RESULT and declare nothing before BEGIN.


CREATE OR REPLACE TYPE BODY book_t
AS
CONSTRUCTOR FUNCTION book_t (id IN INTEGER,
title IN VARCHAR2,
isbn IN VARCHAR2,
pages IN INTEGER)
RETURN SELF AS RESULT
IS
BEGIN
SELF.id := id;
SELF.title := title;
SELF.isbn := isbn;
SELF.pages := pages;
IF isbn IS NULL OR SELF.ck_digit_okay
THEN
RETURN;
ELSE
RAISE_APPLICATION_ERROR(-20000, 'ISBN ' || isbn
|| ' has bad check digit');
END IF;
END;
...
It's all a matter of parsing....

Shakespeare

BTW: in many cases, AS and IS are interchangeable.

Is it possible to know on which rule PLSQL is based for parsing?



You could check out the syntax diagrams in the docs.

Shakespeare


Reply With Quote
  #6  
Old   
O_TEXT
 
Posts: n/a

Default Re: IS and AS - 01-13-2009 , 02:53 AM



Shakespeare a écrit :
Quote:
O_TEXT schreef:
Shakespeare a écrit :
O_TEXT schreef:
I was wondering what is the difference between IS and AS, in general
PL/SQL code.


For instance of FUNCTION book_t, how can oracle know if keyword ending
the header is IS or AS;
I mean if header returns SELF and declare result variable before BEGIN,
or if header returns SELF AS RESULT and declare nothing before BEGIN.


CREATE OR REPLACE TYPE BODY book_t
AS
CONSTRUCTOR FUNCTION book_t (id IN INTEGER,
title IN VARCHAR2,
isbn IN VARCHAR2,
pages IN INTEGER)
RETURN SELF AS RESULT
IS
BEGIN
SELF.id := id;
SELF.title := title;
SELF.isbn := isbn;
SELF.pages := pages;
IF isbn IS NULL OR SELF.ck_digit_okay
THEN
RETURN;
ELSE
RAISE_APPLICATION_ERROR(-20000, 'ISBN ' || isbn
|| ' has bad check digit');
END IF;
END;
...
It's all a matter of parsing....

Shakespeare

BTW: in many cases, AS and IS are interchangeable.

Is it possible to know on which rule PLSQL is based for parsing?



You could check out the syntax diagrams in the docs.

Shakespeare
such as

http://download.oracle.com/docs/cd/A...6/13_elems.htm



Reply With Quote
  #7  
Old   
Shakespeare
 
Posts: n/a

Default Re: IS and AS - 01-13-2009 , 05:12 AM



O_TEXT schreef:
Quote:
Shakespeare a écrit :
O_TEXT schreef:
Shakespeare a écrit :
O_TEXT schreef:
I was wondering what is the difference between IS and AS, in general
PL/SQL code.


For instance of FUNCTION book_t, how can oracle know if keyword ending
the header is IS or AS;
I mean if header returns SELF and declare result variable before BEGIN,
or if header returns SELF AS RESULT and declare nothing before BEGIN.


CREATE OR REPLACE TYPE BODY book_t
AS
CONSTRUCTOR FUNCTION book_t (id IN INTEGER,
title IN VARCHAR2,
isbn IN VARCHAR2,
pages IN INTEGER)
RETURN SELF AS RESULT
IS
BEGIN
SELF.id := id;
SELF.title := title;
SELF.isbn := isbn;
SELF.pages := pages;
IF isbn IS NULL OR SELF.ck_digit_okay
THEN
RETURN;
ELSE
RAISE_APPLICATION_ERROR(-20000, 'ISBN ' || isbn
|| ' has bad check digit');
END IF;
END;
...
It's all a matter of parsing....

Shakespeare

BTW: in many cases, AS and IS are interchangeable.
Is it possible to know on which rule PLSQL is based for parsing?



You could check out the syntax diagrams in the docs.

Shakespeare

such as

http://download.oracle.com/docs/cd/A...6/13_elems.htm

Such is indeed

Shakespeare


Reply With Quote
  #8  
Old   
Shakespeare
 
Posts: n/a

Default Re: IS and AS - 01-13-2009 , 05:30 AM



O_TEXT schreef:
Quote:
Shakespeare a écrit :
O_TEXT schreef:
Shakespeare a écrit :
O_TEXT schreef:
I was wondering what is the difference between IS and AS, in general
PL/SQL code.


For instance of FUNCTION book_t, how can oracle know if keyword ending
the header is IS or AS;
I mean if header returns SELF and declare result variable before BEGIN,
or if header returns SELF AS RESULT and declare nothing before BEGIN.


CREATE OR REPLACE TYPE BODY book_t
AS
CONSTRUCTOR FUNCTION book_t (id IN INTEGER,
title IN VARCHAR2,
isbn IN VARCHAR2,
pages IN INTEGER)
RETURN SELF AS RESULT
IS
BEGIN
SELF.id := id;
SELF.title := title;
SELF.isbn := isbn;
SELF.pages := pages;
IF isbn IS NULL OR SELF.ck_digit_okay
THEN
RETURN;
ELSE
RAISE_APPLICATION_ERROR(-20000, 'ISBN ' || isbn
|| ' has bad check digit');
END IF;
END;
...
It's all a matter of parsing....

Shakespeare

BTW: in many cases, AS and IS are interchangeable.
Is it possible to know on which rule PLSQL is based for parsing?



You could check out the syntax diagrams in the docs.

Shakespeare

such as

http://download.oracle.com/docs/cd/A...6/13_elems.htm

I must admit, constructor functions are not part of the diagrams...
but the parser must be treating a constructor function different than a
'normal' function, knowing it should end with returning .. as result.

Shakespeare


Reply With Quote
  #9  
Old   
Frank van Bortel
 
Posts: n/a

Default Re: IS and AS - 01-22-2009 , 04:13 AM



O_TEXT wrote:
Quote:
Shakespeare a écrit :
O_TEXT schreef:
I was wondering what is the difference between IS and AS, in general
PL/SQL code.


For instance of FUNCTION book_t, how can oracle know if keyword ending
the header is IS or AS;
I mean if header returns SELF and declare result variable before BEGIN,
or if header returns SELF AS RESULT and declare nothing before BEGIN.


CREATE OR REPLACE TYPE BODY book_t
AS
CONSTRUCTOR FUNCTION book_t (id IN INTEGER,
title IN VARCHAR2,
isbn IN VARCHAR2,
pages IN INTEGER)
RETURN SELF AS RESULT
IS
BEGIN
SELF.id := id;
SELF.title := title;
SELF.isbn := isbn;
SELF.pages := pages;
IF isbn IS NULL OR SELF.ck_digit_okay
THEN
RETURN;
ELSE
RAISE_APPLICATION_ERROR(-20000, 'ISBN ' || isbn
|| ' has bad check digit');
END IF;
END;
...
It's all a matter of parsing....

Shakespeare

BTW: in many cases, AS and IS are interchangeable.

Is it possible to know on which rule PLSQL is based for parsing?



http://download.oracle.com/docs/cd/A...82.htm#2064465

as|is clause, meaning it is interchangeable.
Works for all SQL create statements, afaik.

--

Regards,
Frank van Bortel


Reply With Quote
Reply




Thread Tools
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.