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
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
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
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);
>
>
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
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
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
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
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 =
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
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`
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
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 =
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
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
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
> 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).
>
&
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
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
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
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
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
22 matches
Mail list logo