Re: Package procedures can't call builtin's?

From: Graeme Sargent <graeme_at_pyra.co.uk>
Date: Wed, 12 May 1993 11:50:58 GMT
Message-ID: <1993May12.115058.27253_at_pyra.co.uk>


In <1993May11.150441.2441_at_galaxy.gov.bc.ca> adong_at_galaxy.gov.bc.ca writes:

>I'm writing my first stored package in Oracle 7 and am getting the following
>messages:
 

>39/11 PLS-00313: 'MESSAGE' not declared in this scope
>39/11 PL/SQL: Statement ignored
>40/11 PLS-00313: 'BELL' not declared in this scope
>40/11 PL/SQL: Statement ignored
>42/15 PLS-00201: identifier 'ERROR_CODE' must be declared
 

>The code segment causing this is:
> /* Check for error messages */
> ELSIF -3000 < msg_num and msg_num < -1999 THEN
> MESSAGE('E'||TO_CHAR(msg_num)||': '||app_msg);
> BELL;
>
> /* Assume all others are system messages */
>
> ELSIF ERROR_CODE = 0 THEN /* Message type */
> MESSAGE(MESSAGE_TYPE||' '||TO_CHAR(msg_num)||': '||
> MESSAGE_TEXT);
 
>The procedure works fine when embedded in a SQLFORMS 3.0 form. Aren't
>SQLFORMS built-in functions automatically available in SQLPlus?

What's SQLPlus got to do with it? A Stored Procedure/Package is in the database, independent of any particular front-end.

No, SQLFORMS built-ins are not automatically available in Stored Procedures/Packages only PL/SQL ones. Where are you expecting MESSAGE and BELL to send their output to? Stored Procedures execute in the server not the client, there is no terminal style of device to talk to.

Your code fragment indicates that what you're really trying to do is exception handling. Look at EXCEPTION, RAISE and writing PL/SQL Exception Handlers in general.

graeme

--
Disclaimer:	The author's opinions are his own, and not necessarily
		those of Pyramid Technology Ltd. or Pyramid Technology Inc.
---------------------------------------------------------------------------
      -m------- Graeme Sargent                 Voice: +44 (0)252 373035
    ---mmm----- Senior Database Consultant     Fax  : +44 (0)252 373135
  -----mmmmm--- Pyramid Technology Ltd.        Telex: Tell who???
-------mmmmmmm- Farnborough, Hants  GU14 7PL   Email: graeme_at_pyra.co.uk
---------------------------------------------------------------------------
    We have the technology.  The tricky bit is learning how to use it.
Received on Wed May 12 1993 - 13:50:58 CEST

Original text of this message