Error in Stored Procedure?

Mina Gohari

Error in Stored Procedure?
Hi All


I have a SQL stored procedure which it inserts a row to a table, table
contains of 2 fields : Str1 as Varchar(32) and Str2 as Varchar(32).
I have this sql in stored procedure :

declare tempstr varchar(32);
set tempstr = '123';
Insert into tb1 values('123',tempstr);

after running stored procedure , I saw the row in table, it was added
a row with '123' in first column and some graphic char in second char.
Whenever I change the insert statement to :
Insert into tb1 values('123', '123');

It will work properly,

Thanks in advance.

the platform is mainframe with DB2 V6.0 on os/390.

Mina



Bayard Tysor

Re: Error in Stored Procedure?
(in response to Mina Gohari)
Mina,

Don't you have to set the length of tempstr?

Tink
--- Mina Gohari <[login to unmask email]> wrote:
> Hi All
>
>
> I have a SQL stored procedure which it inserts
> a row to a table, table
> contains of 2 fields : Str1 as Varchar(32) and
> Str2 as Varchar(32).
> I have this sql in stored procedure :
>
> declare tempstr varchar(32);
> set tempstr = '123';
> Insert into tb1 values('123',tempstr);
>
> after running stored procedure , I saw the row
> in table, it was added
> a row with '123' in first column and some
> graphic char in second char.
> Whenever I change the insert statement to :
> Insert into tb1 values('123', '123');
>
> It will work properly,
>
> Thanks in advance.
>
> the platform is mainframe with DB2 V6.0 on
> os/390.
>
> Mina
>
>
> To change your subscription options or to cancel
> your subscription visit the DB2-L webpage at
> http://www.ryci.com/db2-l. The owners of the list
> can


=====
B.L. "Tink" Tysor
Bayard Lee Tysor, Inc
(401)965-2688
www.BLTysor.com

__________________________________________________
Do You Yahoo!?
Check out Yahoo! Shopping and Yahoo! Auctions for all of
your unique holiday gifts! Buy at http://shopping.yahoo.com
or bid at http://auctions.yahoo.com



Mina Gohari

Re: Error in Stored Procedure?
(in response to Bayard Tysor)
Tink,
How should I set the length of tempstr?
Thanks

Mina


______________________________ Reply Separator _________________________________
Subject: Re: Error in Stored Procedure?
Author: DB2 Data Base Discussion List <[login to unmask email]> at Internet
Date: 12/11/01 4:44 AM


Mina,

Don't you have to set the length of tempstr?

Tink
--- Mina Gohari <[login to unmask email]> wrote:
> Hi All
>
>
> I have a SQL stored procedure which it inserts
> a row to a table, table
> contains of 2 fields : Str1 as Varchar(32) and
> Str2 as Varchar(32).
> I have this sql in stored procedure :
>
> declare tempstr varchar(32);
> set tempstr = '123';
> Insert into tb1 values('123',tempstr);
>
> after running stored procedure , I saw the row
> in table, it was added
> a row with '123' in first column and some
> graphic char in second char.
> Whenever I change the insert statement to :
> Insert into tb1 values('123', '123');
>
> It will work properly,
>
> Thanks in advance.
>
> the platform is mainframe with DB2 V6.0 on
> os/390.
>
> Mina
>
>
> To change your subscription options or to cancel
> your subscription visit the DB2-L webpage at
> http://www.ryci.com/db2-l. The owners of the list
> can


=====
B.L. "Tink" Tysor
Bayard Lee Tysor, Inc
(401)965-2688
www.BLTysor.com

__________________________________________________
Do You Yahoo!?
Check out Yahoo! Shopping and Yahoo! Auctions for all of
your unique holiday gifts! Buy at http://shopping.yahoo.com
or bid at http://auctions.yahoo.com


DB2
-L webpage at http://www.ryci.com/db2-l. The owners of the list can be reached a
t [login to unmask email]



Bayard Tysor

Re: Error in Stored Procedure?
(in response to Mina Gohari)
Mina,

What language is your Stored Procedure coded in?

Tink
--- Mina Gohari <[login to unmask email]> wrote:
> Tink,
> How should I set the length of tempstr?
> Thanks
>
> Mina
>
>
> ______________________________ Reply Separator
> _________________________________
> Subject: Re: Error in Stored Procedure?
> Author: DB2 Data Base Discussion List
> <[login to unmask email]> at Internet
> Date: 12/11/01 4:44 AM
>
>
> Mina,
>
> Don't you have to set the length of tempstr?
>
> Tink
> --- Mina Gohari <[login to unmask email]> wrote:
> > Hi All
> >
> >
> > I have a SQL stored procedure which it
> inserts
> > a row to a table, table
> > contains of 2 fields : Str1 as Varchar(32)
> and
> > Str2 as Varchar(32).
> > I have this sql in stored procedure :
> >
> > declare tempstr varchar(32);
> > set tempstr = '123';
> > Insert into tb1 values('123',tempstr);
> >
> > after running stored procedure , I saw the
> row
> > in table, it was added
> > a row with '123' in first column and some
> > graphic char in second char.
> > Whenever I change the insert statement to :
> > Insert into tb1 values('123', '123');
> >
> > It will work properly,
> >
> > Thanks in advance.
> >
> > the platform is mainframe with DB2 V6.0 on
> > os/390.
> >
> > Mina
> >
> >
> > To change your subscription options or to cancel
> > your subscription visit the DB2-L webpage at
> > http://www.ryci.com/db2-l. The owners of the list
> > can
>
>
> =====
> B.L. "Tink" Tysor
> Bayard Lee Tysor, Inc
> (401)965-2688
> www.BLTysor.com
>
> __________________________________________________
> Do You Yahoo!?
> Check out Yahoo! Shopping and Yahoo! Auctions for
> all of
> your unique holiday gifts! Buy at
> http://shopping.yahoo.com
> or bid at http://auctions.yahoo.com
>
>
> To change your subscription options or to cancel
> your subscription visit the DB2
> -L webpage at http://www.ryci.com/db2-l. The owners
> of the list can be reached a
> t [login to unmask email]
>
>
> To change your subscription options or to cancel
> your subscription visit the DB2-L webpage at
> http://www.ryci.com/db2-l. The owners of the list
> can


=====
B.L. "Tink" Tysor
Bayard Lee Tysor, Inc
(401)965-2688
www.BLTysor.com