Creating a simple stored procedure

2003-01-30 Thread Bob Metelsky
How can I create this simple stored procedure

Obiviously I don't have much experience but I would not think this being
as difficult as it appears

I want to run an update on a table (eventually from a job) I just need
to get the sp working... Any examples Ive seen are much too complex for
this simple task

CREATE OR REPLACE PROCEDURE XYZ
  AS
 BEGIN
UPDATE myTab SET STATUS = 'a'  WHERE  STATUS = 'b' ;
  END XYZ;

This is telling me I need to declare myTab... Ive tried every iteration
of declaring... But its not happening
So, I present my delimma to my knowledgable friends @fatcity!

{about to go insane}
bob
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Bob Metelsky
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
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 simple stored procedure

2003-01-30 Thread Jamadagni, Rajendra
Title: RE: Creating a simple stored procedure





Have the owner of MyTab grant to appropriate privileges directly, it seems you have them through a role. Also check for a synonym for MyTable as well.

Raj
__
Rajendra Jamadagni  MIS, ESPN Inc.
Rajendra dot Jamadagni at ESPN dot com
Any opinion expressed here is personal and doesn't reflect that of ESPN Inc. 
QOTD: Any clod can have facts, but having an opinion is an art!



-Original Message-
From: Bob Metelsky [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 30, 2003 10:31 AM
To: Multiple recipients of list ORACLE-L
Subject: Creating a simple stored procedure



How can I create this simple stored procedure


Obiviously I don't have much experience but I would not think this being
as difficult as it appears


I want to run an update on a table (eventually from a job) I just need
to get the sp working... Any examples Ive seen are much too complex for
this simple task


CREATE OR REPLACE PROCEDURE XYZ
 AS
BEGIN
UPDATE myTab SET STATUS = 'a' WHERE STATUS = 'b' ;
 END XYZ;


This is telling me I need to declare myTab... Ive tried every iteration
of declaring... But its not happening
So, I present my delimma to my knowledgable friends @fatcity!


{about to go insane}
bob
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Bob Metelsky
 INET: [EMAIL PROTECTED]


Fat City Network Services -- 858-538-5051 http://www.fatcity.com
San Diego, California -- Mailing list and web hosting services
-
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 e-mail 
message is confidential, intended only for the named recipient(s) above and may 
contain information that is privileged, attorney work product or exempt from 
disclosure under applicable law. If you have received this message in error, or are 
not the named recipient(s), please immediately notify corporate MIS at (860) 766-2000 
and delete this e-mail message from your computer, Thank 
you.*2



RE: Creating a simple stored procedure

2003-01-30 Thread Mercadante, Thomas F
Bob,

where does the table mytab exist? - probably not in the same account as
where you are creating the sp.  in this case, you need to do two things.
change the sp to say:

update {schema}.mytab  where {schema} is where the table exists.

secondly, from {schema} you need to : grant select, insert, update, delete
on mytab to {user} where {user} is where the sp exists.

good luck!

Tom Mercadante
Oracle Certified Professional


-Original Message-
Sent: Thursday, January 30, 2003 10:31 AM
To: Multiple recipients of list ORACLE-L


How can I create this simple stored procedure

Obiviously I don't have much experience but I would not think this being
as difficult as it appears

I want to run an update on a table (eventually from a job) I just need
to get the sp working... Any examples Ive seen are much too complex for
this simple task

CREATE OR REPLACE PROCEDURE XYZ
  AS
 BEGIN
UPDATE myTab SET STATUS = 'a'  WHERE  STATUS = 'b' ;
  END XYZ;

This is telling me I need to declare myTab... Ive tried every iteration
of declaring... But its not happening
So, I present my delimma to my knowledgable friends @fatcity!

{about to go insane}
bob
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Bob Metelsky
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
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.net
-- 
Author: Mercadante, Thomas F
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
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 simple stored procedure

2003-01-30 Thread Koivu, Lisa
Title: RE: Creating a simple stored procedure





Hi Bob, 


first of all who are you creating the sp as? 


If it's not the table owner, is there a synonym declared? Is update granted via a role? If it is, grant update directly to the procedure owner. 

Or forget all this and run the proc as the schema owner. 


Lisa Koivu
Oracle Diaper Administrator
Fairfield Resorts, Inc.
5259 Coconut Creek Parkway
Ft. Lauderdale, FL, USA 33063



-Original Message-
From: Bob Metelsky [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 30, 2003 10:31 AM
To: Multiple recipients of list ORACLE-L
Subject: Creating a simple stored procedure



How can I create this simple stored procedure


Obiviously I don't have much experience but I would not think this being
as difficult as it appears


I want to run an update on a table (eventually from a job) I just need
to get the sp working... Any examples Ive seen are much too complex for
this simple task


CREATE OR REPLACE PROCEDURE XYZ
 AS
BEGIN
UPDATE myTab SET STATUS = 'a' WHERE STATUS = 'b' ;
 END XYZ;


This is telling me I need to declare myTab... Ive tried every iteration
of declaring... But its not happening
So, I present my delimma to my knowledgable friends @fatcity!


{about to go insane}
bob
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Bob Metelsky
 INET: [EMAIL PROTECTED]


Fat City Network Services -- 858-538-5051 http://www.fatcity.com
San Diego, California -- Mailing list and web hosting services
-
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 simple stored procedure

2003-01-30 Thread Bob Metelsky

 Bob,
 
 where does the table mytab exist? - probably not in the same 
 account as where you are creating the sp.  in this case, you 
 need to do two things. change the sp to say:
 
 update {schema}.mytab  where {schema} is where the table exists.
 
 secondly, from {schema} you need to : grant select, insert, 
 update, delete on mytab to {user} where {user} is where the sp exists.
 
 good luck!
 
 Tom Mercadante
 Oracle Certified Professional


Tom, thanks for the reply (and thanks to everyone else as well)
The problem was that I was not prefexing the table_name with the owner.
The table did exist in the account I was logged in under but I had to
add the owner for the procedure to reconise it.

I had the necessary permissions in place

I was logged on as the owner of the owner of the tables... I should have
known to prefix with the table_name
(I actually thought I tried that)

So this works:

create or replace procedure closeActivity
 AS
BEGIN  
  UPDATE OWNER.TABLE_NAME
SET
  STATUS='O'
  WHERE STATUS='I' ;
  commit;
END;
/

Then set this in a job:

variable jobno number;
variable instno number;
begin
  select instance_number into :instno from v$instance;
  dbms_job.submit(:jobno, 'OWNER.closeActivity;',  trunc(sysdate+1),
'trunc(SYSDATE+1)', TRUE, :instno);
  commit;
end;
/



I was getting extremely frustrated .

Thanks for the clairity
bob


 
 -Original Message-
 Sent: Thursday, January 30, 2003 10:31 AM
 To: Multiple recipients of list ORACLE-L
 
 
 How can I create this simple stored procedure
 
 Obiviously I don't have much experience but I would not think 
 this being as difficult as it appears
 
 I want to run an update on a table (eventually from a job) I 
 just need to get the sp working... Any examples Ive seen are 
 much too complex for this simple task
 
 CREATE OR REPLACE PROCEDURE XYZ
   AS
  BEGIN
 UPDATE myTab SET STATUS = 'a'  WHERE  STATUS = 'b' ;
   END XYZ;
 
 This is telling me I need to declare myTab... Ive tried every 
 iteration of declaring... But its not happening So, I present 
 my delimma to my knowledgable friends @fatcity!
 
 {about to go insane}
 bob
 -- 

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

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
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 simple stored procedure

2003-01-30 Thread Sony kristanto
Bob,

Make a sure you have access to update 'mytab'.

Rgrds,

Sony

 -Original Message-
 From: Bob Metelsky [SMTP:[EMAIL PROTECTED]]
 Sent: Thursday, January 30, 2003 10:31 PM
 To:   Multiple recipients of list ORACLE-L
 Subject:  Creating a simple stored procedure
 
 How can I create this simple stored procedure
 
 Obiviously I don't have much experience but I would not think this being
 as difficult as it appears
 
 I want to run an update on a table (eventually from a job) I just need
 to get the sp working... Any examples Ive seen are much too complex for
 this simple task
 
 CREATE OR REPLACE PROCEDURE XYZ
   AS
  BEGIN
 UPDATE myTab SET STATUS = 'a'  WHERE  STATUS = 'b' ;
   END XYZ;
 
 This is telling me I need to declare myTab... Ive tried every iteration
 of declaring... But its not happening
 So, I present my delimma to my knowledgable friends @fatcity!
 
 {about to go insane}
 bob
 -- 
 Please see the official ORACLE-L FAQ: http://www.orafaq.net
 -- 
 Author: Bob Metelsky
   INET: [EMAIL PROTECTED]
 
 Fat City Network Services-- 858-538-5051 http://www.fatcity.com
 San Diego, California-- Mailing list and web hosting services
 -
 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.net
-- 
Author: Sony kristanto
  INET: [EMAIL PROTECTED]

Fat City Network Services-- 858-538-5051 http://www.fatcity.com
San Diego, California-- Mailing list and web hosting services
-
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).