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
mysqmail-postfix-logger(8)				      System Manager's Manual					mysqmail-postfix-logger(8)

NAME
mysqmail-postfix-logger - logs smtp traffic to a mysql database SYNOPSIS
mysqmail-postfix-logger subprogram [ args ... ] DESCRIPTION
mysqmail-postfix-logger reads the syslog using tail -F and for each lines, does an action in a selected table in the selected mysql server (configuration done using /etc/mysqmail.conf). All messages that have been delivered are marqued as so in the from and in the to field of the smtp traffic table. mysqmail-postfix-logger uses a table corresponding to this one: CREATE TABLE IF NOT EXISTS smtp_logs ( id int(11) NOT NULL auto_increment, newmsg_id bigint(20) default NULL, bounce_qp int(11) default NULL, bytes int(11) NOT NULL default '0', sender_user varchar(128) NOT NULL default '', sender_domain varchar(128) NOT NULL default '', delivery_id bigint(20) default NULL, delivery_user varchar(128) NOT NULL default '', delivery_domain varchar(128) NOT NULL default '', delivery_success enum('yes','no') NOT NULL default 'no', time_stamp timestamp(14) NOT NULL, PRIMARY KEY (id), UNIQUE KEY bounce_qp (bounce_qp), UNIQUE KEY newmsg_id (newmsg_id), KEY sender_domain (sender_domain), KEY delivery_domain (delivery_domain) ) TYPE=MyISAM; VERSION
This documentation describes mysqmail-postfix-logger version 0.1.4. See http://gplhost.com/softwares-mysqmail.html for updates. SEE ALSO
syslog(3), logger(8) mysqmail-postfix-logger(8)