Home » SQL & PL/SQL » SQL & PL/SQL » Example code for procedure
Example code for procedure [message #244953] Thu, 14 June 2007 12:59 Go to next message
frank01
Messages: 2
Registered: June 2007
Location: Indiana
Junior Member
Hello all. I am new to PLSQL, and was looking for some example PLSQL for the following logic:

for each reporting year do
for each pgm_sys_id do
i. Read TRIS database in tris_facility_rec

ii. Insert in TRI using new FACILITY_ID as primary key and CDX as data type along with all the chemical data.

iii. Check if tris_facility_rec already exist in TRI as CDX-Active record (Match Reporting Year and Pgm Sys Id as business keys).

1. Read tri_facility_rec and update it with tris_facility_rec.

iv. Otherwise

1. Insert tris_facility_rec as new record under CDX-Active data type with new FACILITY_ID as primary key.

v. Check if tris_chemical_rec already exist in TRI as CDX-Active record (Match Cas Number as business key.

1. Read tri_chemical_rec and update it with tris_chemical_rec

2. Update all the data items like WASTE TREATMENT, RELEASES, ACTIVITY and etc.

vi. Otherwise

1. Insert tris_chemical_rec as new record under CDX-Active data type with new CHEMICAL_ID as primary key.

2. Insert all the data items like WASTE TREATMENT, RELEASES, ACTIVITY and etc.

end for.
end for.


Does anyone have an example of a procedure that goes along with this flow? Thank you!

Re: Example code for procedure [message #244954 is a reply to message #244953] Thu, 14 June 2007 13:01 Go to previous messageGo to next message
MarcL
Messages: 455
Registered: November 2006
Location: Connecticut, USA
Senior Member
Is that an RFP ? If so I can give you a quote
Re: Example code for procedure [message #244967 is a reply to message #244954] Thu, 14 June 2007 13:53 Go to previous messageGo to next message
frank01
Messages: 2
Registered: June 2007
Location: Indiana
Junior Member
Hello. No, it is not for an RFP. I was just looking for a similiar type of procedure as a starting point. I have to work on it for completion very soon, and was not sure how to start it.

Any assistance would be appreciated!

Thank you!
Re: Example code for procedure [message #244968 is a reply to message #244953] Thu, 14 June 2007 14:02 Go to previous message
BlackSwan
Messages: 25033
Registered: January 2009
Location: SoCal
Senior Member
When all else fails, you could actually try Reading The Fine PL/SQL Reference Manual.
http://download-west.oracle.com/docs/cd/B19306_01/appdev.102/b14261/toc.htm

Also http://asktom.oracle.com has many, many fine coding examples

HTH & YMMV!
Previous Topic: NOT IN Vs NOT EXIST
Next Topic: problem with oracle sql+
Goto Forum:
  


Current Time: Fri Dec 02 20:40:47 CST 2016

Total time taken to generate the page: 0.12801 seconds