imrank


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting imrank
# 1  
Old 06-14-2009
Tools imrank

Hi Smilie

I created a sp with one IN param.
declared a variable with int type, say
=========================================
> delimiter //
create procedure tst(IN t1 varchar(20)
)
begin
declare c1 int;
set c1 = (select seednum+1 from SeedData where RecId=1);
insert into b2(f1, f2) values (t1, c1);
Update SeedData set seednum=seednum+1;
end;
//
========================================
> CALL tst('Test')


Mysql throw an exception saying f2 cannot be NULL!!!

Indeed in table B2 the field f2 is flagged as NOT NULL
hence int data must be passed on to this field; Which happen to be retrieved by
set c1 statement using Select seednum+1,
Many attempt made to see that the c1 does retrieve value from its query? It does
retrieve the value from query but does not retain for insert statement.

Using Select c1 I can see it has a intended value which I am seeking but when it come to INSERT statement execution there is non or NULL!!

What Is wrong here these statement perfectly running at MS SQL server now I am migrating to MYSQL

Please any advise, tip,where is I am wrong?

Thank in advance.
IK
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question