This is a discussion on Newbie Question within the DB2 forums, part of the Database Server Software category; --> I can't seem to find the eqivalent to the MSSQLServer "print" command ?...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| Randy wrote: > I can't seem to find the eqivalent to the MSSQLServer "print" command ? > > There is none. What are your trying to do? If you want to compose a report us a cursor or a temporrary table. If you want to debug, use the SQL Procedure debugger. Cheers Serge -- Serge Rielau DB2 Solutions Development IBM Toronto Lab |
| |||
| Thanx Serge. "Serge Rielau" <srielau@ca.ibm.com> wrote in message news:454r0eF4vaplU1@individual.net... > Randy wrote: >> I can't seem to find the eqivalent to the MSSQLServer "print" command ? >> >> > There is none. What are your trying to do? > If you want to compose a report us a cursor or a temporrary table. > If you want to debug, use the SQL Procedure debugger. > > Cheers > Serge > > -- > Serge Rielau > DB2 Solutions Development > IBM Toronto Lab |
| |||
| Thanx Cheng. Is there any way I can Declare variables and use "select into's" etc, within a CommandEditor session? I would like to mix commands like EXPORT into the PL. I think I am limited in what I can do with stored procedures and I am limited with what I can do with clp ( same as CommandEditor?) ... or so it seems. Randy <cheng.j3@gmail.com> wrote in message news:1139634742.847085.216610@g47g2000cwa.googlegr oups.com... > Are you trying to print out character strings from db2 clp ? try > "echo" > >>db2 echo "Hello World !" > Hello World ! > > Cheng > |
| |||
| Randy wrote: > Thanx Cheng. Is there any way I can Declare variables and use "select > into's" etc, within a CommandEditor session? I would like to mix commands > like EXPORT into the PL. I think I am limited in what I can do with stored > procedures and I am limited with what I can do with clp ( same as > CommandEditor?) ... or so it seems. > > Randy > > > <cheng.j3@gmail.com> wrote in message > news:1139634742.847085.216610@g47g2000cwa.googlegr oups.com... > >>Are you trying to print out character strings from db2 clp ? try >>"echo" >> >> >>>db2 echo "Hello World !" >> >>Hello World ! >> Take your pick at PERL, PHP, shell-scripts... Cheers Serge -- Serge Rielau DB2 Solutions Development IBM Toronto Lab |
| |||
| You can declare variables in "a compound statement block, which groups multiple independent SQL statement into single block". (See SQL Cookbook, Graeme Birchall) BEGIN ATOMIC DECLARE v_rows INT; SET v_rows = (SELECT Count(*) AS c FROM SYSCAT.COLUMNS WHERE TABNAME = 'TAB1' AND COLNAME = 'ID'); IF v_rows=0 THEN CALL sample_proc(); END IF; END # HTH, Adrian |
| |||
| Thanx ! I tried using a "compound statement block" in my Command Editor session and it returned an error. BEGIN ATOMIC DECLARE v_rows INT DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned: SQL0104N An unexpected token "INT" was found followin If I can use 'blocking' in CLP or Command Editor, it would solve my woes .... <adik_q@wp.pl> wrote in message news:1139836375.473547.194390@g43g2000cwa.googlegr oups.com... > You can declare variables in "a compound statement block, which groups > multiple independent SQL statement into single block". > (See SQL Cookbook, Graeme Birchall) > > BEGIN ATOMIC > DECLARE v_rows INT; > > SET v_rows = (SELECT Count(*) AS c FROM SYSCAT.COLUMNS WHERE > TABNAME = 'TAB1' AND COLNAME = 'ID'); > > IF v_rows=0 THEN > CALL sample_proc(); > END IF; > END > # > > HTH, > Adrian > |
| |||
| Randy wrote: > > Thanx ! I tried using a "compound statement block" in my Command Editor > session and it returned an error. > > BEGIN ATOMIC > DECLARE v_rows INT > DB21034E The command was processed as an SQL statement because it was not > a > valid Command Line Processor command. During SQL processing it returned: > SQL0104N An unexpected token "INT" was found followin > > If I can use 'blocking' in CLP or Command Editor, it would solve my woes > ... Which version of DB2 are you running and on which platform? What are you using as statement terminator? Your statement worked quite fine for me, suggesting that you have some other problem, not related to the statement itself. $ db2 -td@ db2 => begin atomic db2 (cont.) => declare v_rows int; db2 (cont.) => set v_rows = 1; db2 (cont.) => end@ DB20000I The SQL command completed successfully. -- Knut Stolze DB2 Information Integration Development IBM Germany |
| ||||
| I have the personal edition at home. I haven't tried this stuff at the office yet. DB2 UDB 8.1.1 / Windows XP CLP says DB2/NT 8.2.3 My terminator is ; that's what it says at the bottom of the Command Editor windows. Randy "Knut Stolze" <stolze@de.ibm.com> wrote in message news:dss67q$s3g$1@lc03.rz.uni-jena.de... > Randy wrote: > >> >> Thanx ! I tried using a "compound statement block" in my Command Editor >> session and it returned an error. >> >> BEGIN ATOMIC >> DECLARE v_rows INT >> DB21034E The command was processed as an SQL statement because it was >> not >> a >> valid Command Line Processor command. During SQL processing it returned: >> SQL0104N An unexpected token "INT" was found followin >> >> If I can use 'blocking' in CLP or Command Editor, it would solve my woes >> ... > > Which version of DB2 are you running and on which platform? > What are you using as statement terminator? > > Your statement worked quite fine for me, suggesting that you have some > other > problem, not related to the statement itself. > > $ db2 -td@ > > db2 => begin atomic > db2 (cont.) => declare v_rows int; > db2 (cont.) => set v_rows = 1; > db2 (cont.) => end@ > DB20000I The SQL command completed successfully. > > -- > Knut Stolze > DB2 Information Integration Development > IBM Germany |