Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2004
    Posts
    54

    Unanswered: DB2 v8, PL SQL question.

    Hi!
    Have you idea if is possible to merge simple sql statements with pl sql statements in one file and execute with "db2 -tf file.sql" ?
    Example file.sql:

    BEGIN ATOMIC
    FOR row AS
    SELECT name AS nametable FROM sysibm.systables
    DO
    IF row.nametable = 'table1' THEN
    drop table table1;
    END IF;
    END FOR;
    END
    @

    create table pippo (idpippo decimal(18), desc varchar(50));
    insert into pippo values (1,'ciao');

    create table table2 (idtable1 decimal(18);
    create table table3 (idtable1 decimal(18);


    thank you!

    Fabio

  2. #2
    Join Date
    Nov 2005
    Location
    IL
    Posts
    557
    sure, create a shell script and you are done.
    --
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows

    DB2 v9.7.0.6 os 6.1.0.0

  3. #3
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    Unless you are working on DB2 z/OS, you should never ever rely on internals like the tables in the SYSIBM schema - use the views in schema SYSCAT instead. (The exception are the SYSIBM tables that you can find in the manuals.)
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •