MySQL Forums
Forum List  »  Stored Procedures

Select count(*) INTO
Posted by: Andrea Iampieri
Date: November 06, 2013 05:03AM

Hi all,
I am creating a procedure and the following query produces a result of 1 when launched individually:

SELECT COUNT(*) as counter
FROM INFORMATION_SCHEMA.PARTITIONS
WHERE TABLE_SCHEMA = 'my_dwh'
AND TABLE_NAME = 'report_position'
AND PARTITION_NAME = 'p143';

why in the procedure I always have a value of 0?
This is my code:

...
DECLARE partition_count BIGINT UNSIGNED DEFAULT 0;

SELECT COUNT(*) AS counter
FROM INFORMATION_SCHEMA.PARTITIONS
WHERE TABLE_SCHEMA = 'my_dwh'
AND TABLE_NAME = 'report_position'
AND PARTITION_NAME = 'p143'
INTO partition_count;
...

Thank you in advance,

Andrea

Options: ReplyQuote


Subject
Views
Written By
Posted
Select count(*) INTO
11167
November 06, 2013 05:03AM
1344
November 09, 2013 04:23PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.