Re: Trying to Generate Dynamic Sequence IDs as Stored Function or Stored Procedure.

2011-01-05 Thread Shawn Green (MySQL)
a stored function? Maybe some variation of this will help? http://stackoverflow.com/questions/805808/emulating-a-transaction-safe-sequence-in-mysql I don't understand the need for a SEQUENCE. In my history, if there is some kind of object identifier you want to use, then an auto_incr

Re: Trying to Generate Dynamic Sequence IDs as Stored Function or Stored Procedure.

2011-01-05 Thread James Dekker
Because some sequence tables contain one to many cardinality and MySQL tables can only have one auto_increment column... Is there a way to do what I am trying to do (obtain max sequence id, set it to its corresponding table, and then increment by one) in a stored function? Happy programming

Re: Trying to Generate Dynamic Sequence IDs as Stored Function or Stored Procedure.

2011-01-05 Thread Shawn Green (MySQL)
at line 1 Is there a better way to generate incremented sequence IDs? Can this be done in a stored function? Is there a particular reason why you cannot use an auto_increment column to atomically create your sequence number? -- Shawn Green MySQL Principal Technical Support Engineer Oracl

Re: Trying to Generate Dynamic Sequence IDs as Stored Function or Stored Procedure.

2011-01-04 Thread James Dekker
o generate incremented sequence IDs? Can this be done in a stored function? Happy programming, James On Jan 4, 2011, at 7:45 PM, Peter Brawley wrote: >> generate_dynamic_id('my_sequence_id_s', 'my_table_t', 'table_id', >> @dynamicId); > >

Re: Trying to Generate Dynamic Sequence IDs as Stored Function or Stored Procedure.

2011-01-04 Thread Peter Brawley
generate_dynamic_id('my_sequence_id_s', 'my_table_t', 'table_id', @dynamicId); Should be: CALL generate_dynamic_id('my_sequence_id_s', 'my_table_t', 'table_id', @dynamicId); PB On 1/4/2011 9:28 PM, James Dekker wrote: Hello there, I am using MySQL 5 on OS X - Snow Leopard... Have w

Trying to Generate Dynamic Sequence IDs as Stored Function or Stored Procedure.

2011-01-04 Thread James Dekker
Hello there, I am using MySQL 5 on OS X - Snow Leopard... Have working code in place which obtains the highest sequence number ID from a sequence table and then increments and assigns it to its corresponding table: The original code's purpose is to dynamically increments a specific table's las

Re: Retrieving results of a stored function using MySql C API

2009-04-16 Thread Moon's Father
Yeah, please show us the source code of yours. On Wed, Apr 15, 2009 at 4:10 PM, Venu Gopal wrote: > Hi guys, > I am using stored procedures and stored functions for the first time. > And currently stuck at a this point where. I am unable to retrieve > results returned by stored fu

Retrieving results of a stored function using MySql C API

2009-04-15 Thread Venu Gopal
Hi guys, I am using stored procedures and stored functions for the first time. And currently stuck at a this point where. I am unable to retrieve results returned by stored function using MySql C API. Kindly let me know how to do so. In case you need details I'll share the source code. C

Problem using deterministic stored function

2009-02-22 Thread Peter Thomassen
Hi, I am using MySQL 5.0.51a. I've got a problem with a stored function. It reads as follows: CREATE FUNCTION `_contractRoot`(temp INT) RETURNS int(11) READS SQL DATA BEGIN DECLARE _parent_id INT; REPEAT SET _parent_id =

How to call a stored procedure from a stored function with parameter?

2007-09-29 Thread Zsolt Csillag
Hello, I have the following stored procedure PROCEDURE `IsProductInForeignDatabase`(IN stock INTEGER(11), OUT MyResult VARCHAR(1000), IN Behaviour VARCHAR(20)) The procedure above returns the "MyResult" out parameter. I have a stored function as well thas has the body: Begin Declar

Stored function problem

2007-05-22 Thread Olaf Stein
Hi All, I have a problem that I do not quite understand. I have a table with individuals: CREATE TABLE `individual` ( `ident` mediumint(8) unsigned NOT NULL auto_increment, `fid` mediumint(8) unsigned NOT NULL, `iid` mediumint(8) unsigned NOT NULL, PRIMARY KEY (`ident`), KEY `fidiid`

Re: Table doesn't exist from stored function

2007-03-11 Thread Peter Brawley
Imre, You may have found a stored function bug--the server tries to evaluate the SELECT statement within the IF block when IF condition is false. PB - Shawn Green wrote: Hello Imre, Imre Palik wrote: Hi, When I try to run this function, I receive ERROR 1146 (42S02): Table 'gi2

Re: Table doesn't exist from stored function

2007-03-11 Thread Shawn Green
Hello Imre, Imre Palik wrote: Hi, When I try to run this function, I receive ERROR 1146 (42S02): Table 'gi2.meta' doesn't exist CREATE FUNCTION get_version() RETURNS INT UNSIGNED BEGIN DECLARE exist_ TINYINT; SELECT COUNT(*) INTO exist_ FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA =

Table doesn't exist from stored function

2007-03-07 Thread Imre Palik
Hi, When I try to run this function, I receive ERROR 1146 (42S02): Table 'gi2.meta' doesn't exist CREATE FUNCTION get_version() RETURNS INT UNSIGNED BEGIN DECLARE exist_ TINYINT; SELECT COUNT(*) INTO exist_ FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'GI2' AND TABLE_NAME = 'Meta' L

RE: Weird error with stored function

2006-11-24 Thread imre
more than a few hours of experience with the MySQL codebase can see some possible pitfalls in this fix. Thx ImRe > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: 23 November 2006 12:14 > To: 'mysql@lists.mysql.com' > Subject: Weird error

Weird error with stored function

2006-11-23 Thread imre
Hi, I am trying to use stored functions through the prepared statement C API. I have one application that issues relatively long running queries, while the other is doing some inserts, updates, and short queries. If the second application somehow calls a stored function (either directly through

Re: Stored function

2005-09-01 Thread Martijn Tonies
> I'm running "MySQL 4.0.23-standard", and trying to create a stored function. > Am I doing something wrong, or can I not create a stored function in 4.0.23? > What I want is a stored function to take an int from a column and alter it > (mask off the low 16-bits). > &

Stored function

2005-09-01 Thread Dan Baker
I'm running "MySQL 4.0.23-standard", and trying to create a stored function. Am I doing something wrong, or can I not create a stored function in 4.0.23? What I want is a stored function to take an int from a column and alter it (mask off the low 16-bits). SQL-query : CREATE FU

Re: Stored function problems (Was: UDF failure)

2005-07-07 Thread Peter Brawley
Nic, At the end of the func, your sproc delimiter // needs to come before restoration of the semi-colon as delimiter, thus: DELIMITER // CREATE FUNCTION hello (s CHAR(20)) RETURNS CHAR(50) RETURN CONCAT('Hello, ',s,'!'); // DELIMITER ; PB - Nic Stevens wrote: Hi, Still having di

Re: Stored function problems (Was: UDF failure)

2005-07-07 Thread Paul DuBois
At 11:41 -0700 7/7/05, Nic Stevens wrote: Hi, Still having difficulty with stored functions. I downloaded and installed MySQL 5.0.7 and I *still* cannot get stored functions to work. I used the example for hello from section 19.2.1 of the online documentation for MySQL and the example code doe

Stored function problems (Was: UDF failure)

2005-07-07 Thread Nic Stevens
Hi, Still having difficulty with stored functions. I downloaded and installed MySQL 5.0.7 and I *still* cannot get stored functions to work. I used the example for hello from section 19.2.1 of the online documentation for MySQL and the example code doesnt work for me either. Below are the

Stored Function with many parameters?

2004-02-16 Thread Hong-Wan, Kim
To make it simple, is it possible to make function having many undecided parameters with MySQL 5.0 stored procedure/function? For example, add(3) add(3,5) add(3,5,1,4,9) add(3,5,1,4,9,8,6,7,2) In C, we use pointer to handle this, but I don't know how to code this at stored function C