469,891 Members | 2,288 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,891 developers. It's quick & easy.

running SQL scripts from CLP ?

hi Gurus out there ... sorry for the newbie question.

I have an Oracle background, so I'm having some trouble trying to port some ideas to the DB2 environment. I'm sure you know all this off the top of your head, so I wonder if you could give me a little hand?

I basically need to write a simple SQL script, to be executed from within a ksh script (Unix - AIX), against a DB2 database. It would run like this:

Db2 connect to INSTANCE_NAME user XXXX using PPP
Db2 -tvf SCRIPT.SQL -z output.out

My questions are regarding what I can do in the SQL script and especially the syntax... For example, I need basic stuff like:

- declare variables
- declare a cursor and fetch rows from it
- run "select into variable" type of select
- execute some date formatting functions

Can I do all of this without being a stored procedure?

I understand that I could do all this in a Stored Procedure, but that would complicate things, I'd like to have a basic SQL script instead, because of time constraints.

Do you know if there's a manual out there with examples? Once I see the syntax, I'll figure it out.

If anyone could help me out in any way or just reply with basic examples, that would be fantastic!

Thanks,

Gmont
Jan 4 '07 #1
0 2833

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Rolfe | last post: by
4 posts views Thread by Peter Otten | last post: by
1 post views Thread by Patrick | last post: by
4 posts views Thread by Nick Sinclair | last post: by
1 post views Thread by edovale | last post: by
6 posts views Thread by Ishpeck | last post: by
24 posts views Thread by Mark | last post: by
22 posts views Thread by V S Rawat | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.