creating a procedure

2002-01-23 Thread Lance Prais

I want to create a stored procedure that takes the following information and
puts it into a table.  How would I do this?

CREATE OR REPLACE Procedure Used_license as
Begin
Select A.Pc_session_id From pt_client_event A where A.pc_event_op = 'LAUNCH'
and A.pc_date =SYSDATE -1
minus
Select B.Pc_session_id From pt_client_event B where B.Pc_event_op = 'LOGOUT'
and B.pc_date =SYSDATE -1
End;


I am tying to do it this way but getting errors:

PLS-00103: Encountered the symbol END when expecting one of the following:

   *  - + ; / for mod rem an exponent (**) and or group having
   intersect minus order start union where connect ||



-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Lance Prais
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



RE: creating a procedure

2002-01-23 Thread Seefelt, Beth


I think you need a ; at the end of the select statement.

-Original Message-
Sent: Wednesday, January 23, 2002 6:20 PM
To: Multiple recipients of list ORACLE-L


I want to create a stored procedure that takes the following information and
puts it into a table.  How would I do this?

CREATE OR REPLACE Procedure Used_license as
Begin
Select A.Pc_session_id From pt_client_event A where A.pc_event_op = 'LAUNCH'
and A.pc_date =SYSDATE -1
minus
Select B.Pc_session_id From pt_client_event B where B.Pc_event_op = 'LOGOUT'
and B.pc_date =SYSDATE -1
End;


I am tying to do it this way but getting errors:

PLS-00103: Encountered the symbol END when expecting one of the following:

   *  - + ; / for mod rem an exponent (**) and or group having
   intersect minus order start union where connect ||



-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Lance Prais
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Seefelt, Beth
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



RE: creating a procedure

2002-01-23 Thread Gogala, Mladen

You used an incorrect name for the procedure. Here 
is one that compiles flawlessly:

CREATE OR REPLACE Procedure RTFM
Begin
Select A.Pc_session_id From pt_client_event A 
   where A.pc_event_op = 'LAUNCH'
   and A.pc_date =SYSDATE -1
minus
Select B.Pc_session_id From pt_client_event B 
   where B.Pc_event_op = 'LOGOUT'
   and B.pc_date =SYSDATE -1;
End;



The procedure will now compile run without a glitch.
It will not do anything, but it will compile. Name is everything!
Oh, what the heck, it has been a long day in the office!


-Original Message-
Sent: Wednesday, January 23, 2002 6:20 PM
To: Multiple recipients of list ORACLE-L


I want to create a stored procedure that takes the following information and
puts it into a table.  How would I do this?

CREATE OR REPLACE Procedure Used_license as
Begin
Select A.Pc_session_id From pt_client_event A where A.pc_event_op = 'LAUNCH'
and A.pc_date =SYSDATE -1
minus
Select B.Pc_session_id From pt_client_event B where B.Pc_event_op = 'LOGOUT'
and B.pc_date =SYSDATE -1
End;


I am tying to do it this way but getting errors:

PLS-00103: Encountered the symbol END when expecting one of the following:

   *  - + ; / for mod rem an exponent (**) and or group having
   intersect minus order start union where connect ||



-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Lance Prais
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Gogala, Mladen
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



Re: creating a procedure

2002-01-23 Thread Peter . McLarty

I think that all you need is a ; before the end You need to close your 
statement within the procedure body 


--
=
Peter McLarty   E-mail: [EMAIL PROTECTED]
Technical ConsultantWWW: http://www.mincom.com
APAC Technical Services Phone: +61 (0)7 3303 3461
Brisbane,  AustraliaMobile: +61 (0)402 094 238
Facsimile: +61 (0)7 3303 3048
=
A great pleasure in life is doing what people say you cannot do.

- Walter Bagehot (1826-1877 British Economist)
=
Mincom The People, The Experience, The Vision

=







Lance Prais [EMAIL PROTECTED]
Sent by: [EMAIL PROTECTED]
24/01/2002 09:20 AM
Please respond to ORACLE-L

 
To: Multiple recipients of list ORACLE-L [EMAIL PROTECTED]
cc: 
Fax to: 
Subject:creating a procedure


I want to create a stored procedure that takes the following information 
and
puts it into a table.  How would I do this?

CREATE OR REPLACE Procedure Used_license as
Begin
Select A.Pc_session_id From pt_client_event A where A.pc_event_op = 
'LAUNCH'
and A.pc_date =SYSDATE -1
minus
Select B.Pc_session_id From pt_client_event B where B.Pc_event_op = 
'LOGOUT'
and B.pc_date =SYSDATE -1
End;


I am tying to do it this way but getting errors:

PLS-00103: Encountered the symbol END when expecting one of the 
following:

   *  - + ; / for mod rem an exponent (**) and or group having
   intersect minus order start union where connect ||



-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Lance Prais
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).





-- 
This transmission is for the intended addressee only and is confidential information.  
If you have received this transmission in error, please delete it and notify the 
sender.  The contents of this e-mail are the opinion of the writer only and are not 
endorsed by the Mincom Group of companies unless expressly stated otherwise.

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: 
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



RE: creating a procedure

2002-01-23 Thread Jacques Kilchoer
Title: RE: creating a procedure





 -Original Message-
 From: Lance Prais [mailto:[EMAIL PROTECTED]]
 
 I want to create a stored procedure that takes the following 
 information and
 puts it into a table. How would I do this?
 
 CREATE OR REPLACE Procedure Used_license as
 Begin
 Select A.Pc_session_id From pt_client_event A where 
 A.pc_event_op = 'LAUNCH'
 and A.pc_date =SYSDATE -1
 minus
 Select B.Pc_session_id From pt_client_event B where 
 B.Pc_event_op = 'LOGOUT'
 and B.pc_date =SYSDATE -1
 End;
 
 I am tying to do it this way but getting errors:
 
 PLS-00103: Encountered the symbol END when expecting one of 
 the following:
 
 *  - + ; / for mod rem an exponent (**) and or group having
 intersect minus order start union where connect ||



You are going to have to store the result of a query into a variable. Does the query return one row or more? If you just want to put the results of your query in to a table, use an insert ... select ...

Some examples:


create or replace procedure x
as
 my_dummy sys.dual.dummy%type ;
 my_object_name sys.dba_objects.object_name%type ;


 cursor c_obj_name (c_owner in varchar2) is
 select object_name from dba_objects where owner = c_owner ;
begin
 /* example of query that returns only one row */
 select dummy into my_dummy from dual ;


 /* example of query that returns several rows */
 for c_obj_rec in c_obj_name ('SYSTEM')
 loop
 my_object_name := c_obj_rec.object_name ;
 end loop ;
end ;
/





RE: creating a procedure

2002-01-23 Thread Steve McClure

I am not one to usually shout RTFM from the mountain top, but I somehow feel
compelled because I have read a couple of responses that hadn't mentioned
that age old mantra.

Your procedure might be salvagable by putting a ; at the end of your select
statement, but I don't believe it will do anything more than compile.  You
need to look into The Oracle Docs on PL/SQL.  Because while you might have
created a procedure, it isn't very procedural.

Steve McCLure

-Original Message-
Sent: Wednesday, January 23, 2002 3:20 PM
To: Multiple recipients of list ORACLE-L


I want to create a stored procedure that takes the following information and
puts it into a table.  How would I do this?

CREATE OR REPLACE Procedure Used_license as
Begin
Select A.Pc_session_id From pt_client_event A where A.pc_event_op = 'LAUNCH'
and A.pc_date =SYSDATE -1
minus
Select B.Pc_session_id From pt_client_event B where B.Pc_event_op = 'LOGOUT'
and B.pc_date =SYSDATE -1
End;


I am tying to do it this way but getting errors:

PLS-00103: Encountered the symbol END when expecting one of the following:

   *  - + ; / for mod rem an exponent (**) and or group having
   intersect minus order start union where connect ||



--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Lance Prais
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Steve McClure
  INET: [EMAIL PROTECTED]

Fat City Network Services-- (858) 538-5051  FAX: (858) 538-5051
San Diego, California-- Public Internet access / Mailing Lists

To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).