Subject | Re: [IBO] How to declare variable in query? |
---|---|
Author | Rafael Colucci |
Post date | 2004-05-19T14:05:03Z |
Hi
I understanded ... thank you.
I will get this documents ... and I promisse you that i will study later ...
Rafael
n
I understanded ... thank you.
I will get this documents ... and I promisse you that i will study later ...
Rafael
> Hi Rafael,http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_download_documentatio
>
> > No .. is not this. I need to do in query ... like this:
> >
> > DECLARE varCount integer;
> > begin
> > SELECT Count(*) FROM Conta WHERE NomeConta = 'gugu' into varcount;
> > if (varCount <= 0) then
> > INSERT INTO Conta (NomeConta,IsAtiva) VALUES ('gugu', 1);
> >
> > This query works if I put in stored procedure, but not work if i put
> > like:
> >
> > Ib_Query.sql.text :=
> > DECLARE varCount integer;
> > begin
> > SELECT Count(*) FROM Conta WHERE NomeConta = 'gugu' into varcount;
> > if (varCount <= 0) then
> > INSERT INTO Conta (NomeConta,IsAtiva) VALUES ('gugu', 1);
>
> You can't put that in a Query. A Query always contains a single SQL
> statement. It can be complex and multiline, but it's still a single
> statement.
>
> For multiple statements in a row, and for procedure and trigger
> definitions, you need a TIB_Script.
>
> BTW, are you sure that "DECLARE varCount integer;" works? As far as I
> know it must be "DECLARE VARIABLE".
>
> Do you have the Firebird Quickstart Guide and the InterBase 6.0
> documentation set, especially the Data Definition Guide? I think you
> should study those. You can get them at
>
>
n
>___________________________________________________________________________
>
> Greetings,
> Paul Vinkenoog
>
>
>
>
>
> IB Objects - direct, complete, custom connectivity to Firebird orInterBase
> without the need for BDE, ODBC or any other layer.___________________________________________________________________________
>
> http://www.ibobjects.com - your IBO community resource for Tech Infopapers,
> keyword-searchable FAQ, community code contributions and more !
> Yahoo! Groups Links
>
>
>
>