Re: PL\SQL package creation

From: Zvika Glickman <zglickman_at_il.bphx.com>
Date: 23 Sep 2004 01:43:05 -0700
Message-ID: <b6b91e64.0409230043.1acbe6f0_at_posting.google.com>


gelewyc_at_nyct.com (george lewycky) wrote in message news:<68aecc05.0409221232.407c8e54_at_posting.google.com>...
> You need to create the PACKAGE before the PACKAGE BODY
>
> George
>
>
>
>
>
>
>
> "Mark C. Stock" <mcstockX_at_Xenquery .com> wrote in message news:<Xf6dnTIpMZkQEczcRVn-rQ_at_comcast.com>...
> > "DCP" <vaagh_at_hotmail.com> wrote in message
> > news:f5c10fa85d76815cf0463b1e210193d3_at_localhost.talkaboutdatabases.com...
> > | Hi,
> > |
> > | I have following code:
> > | (seems very simple but tricky)
> > |
> > |
> > | 1-- create or replace package testNameConcate
> > | 2-- is
> > | 3-- function disp(Name varchar)
> > | 4-- return varchar;
> > | 5-- end testNameConcate;
> > | 6-- /
> > | 7-- create or replace package body testNameConcate
> > | 8-- is
> > | 9-- function disp(Name varchar)
> > | 10-- return varchar
> > | 11-- is
> > | 12-- nm varchar(25);
> > | 13-- begin
> > | 14-- nm='Hello ' || Name;
> > | 15-- return nm;
> > | 16-- end testNameConcate;
> > | /
> > |
> > | As u see "/" is need at line 6 other wise it gives me an error
> > |
> > | PLS-00103: Encountered the symbol "CREATE" at line 7
> > |
> > | but sill this code is giving me a same error, and now it has problem with
> > | "/" and error is
> > |
> > | PLS-00103: Encountered the symbol "/" at line 6
> > |
> > | What am i missing here?
> > |
> > |
> >
> > code is fine -- it's probably the way you're running it. i would assume that
> > you've got all this code in the SQL buffer and then attempt to execute it as
> > if it is a single SQL statement -- it's actually two SQL statements, so you
> > need to save it to a named script file (not the default afiedt.buf that gets
> > created when you do a plain EDIT in SQL*Plus) and then use '_at_filename' or
> > 'start filename' to execute the script
> >
> > also: user varchar2 instead of varchar -- oracle's been saying the following
> > since v7 or v6:
> >
> > "VARCHAR Datatype
> > "The VARCHAR datatype is currently synonymous with the VARCHAR2 datatype.
> > Oracle recommends that you use VARCHAR2 rather than VARCHAR. In future
> > releases, VARCHAR might be defined as a separate datatype used for
> > variable-length
> > character strings compared with different comparison semantics."
> >
> > ++ mcs

  1. The / must be at first column. [Quoted]
  2. There are other errors in the package body. Attached a fixed code:

create or replace package testNameConcate is
function disp(Name varchar)
return varchar;
end testNameConcate;
/
create or replace package body testNameConcate is
function disp(Name varchar)
return varchar
is
 nm varchar(25);
begin
 nm:='Hello ' || Name;
 return nm;
end;
end testNameConcate;
/ Received on Thu Sep 23 2004 - 10:43:05 CEST

Original text of this message