MySQL Forums
Forum List  »  Italian

eseguire una stringa come una query
Posted by: lele tert
Date: April 22, 2008 10:07AM

Ciao,
ho un problema con l'esecuzione di una query costruita con l'unione di stringhe a seconda del percorso preso in delle if....

Ho fatto così:

nella variabile q2 ho una query di questo tipo:
q2 = 'SELECT campi FROM tabelle where condizioni_in_And;'

la query si trova in una Store Procedure che ha una decina di parametri IN che possono essere anche NULL.

Prima di chiudere la SP, ho inserito per provare il risultato:
SET @dacrea='2008-01-01';
SET @acrea='2008-04-22';
PREPARE stmt1 FROM @q2;
EXECUTE stmt1 USING @dacrea,@acrea;
DEALLOCATE PREPARE stfm1;

mi da sempre un errore sulla sintassi "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1"

Qual'è il problema?

Help me!!!!

Ciao

Options: ReplyQuote


Subject
Views
Written By
Posted
eseguire una stringa come una query
5749
April 22, 2008 10:07AM


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.