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
set(n)							       Tcl Built-In Commands							    set(n)

__________________________________________________________________________________________________________________________________________________

NAME
set - Read and write variables SYNOPSIS
set varName ?value? _________________________________________________________________ DESCRIPTION
Returns the value of variable varName. If value is specified, then set the value of varName to value, creating a new variable if one doesn't already exist, and return its value. If varName contains an open parenthesis and ends with a close parenthesis, then it refers to an array element: the characters before the first open parenthesis are the name of the array, and the characters between the parentheses are the index within the array. Otherwise varName refers to a scalar variable. Normally, varName is unqualified (does not include the names of any containing namespaces), and the variable of that name in the current namespace is read or written. If varName includes names- pace qualifiers (in the array name if it refers to an array element), the variable in the specified namespace is read or written. If no procedure is active, then varName refers to a namespace variable (global variable if the current namespace is the global namespace). If a procedure is active, then varName refers to a parameter or local variable of the procedure unless the global command was invoked to declare varName to be global, or unless a variable command was invoked to declare varName to be a namespace variable. SEE ALSO
expr(n), proc(n), trace(n), unset(n) KEYWORDS
read, write, variable Tcl set(n)