Subject Re: Problem with Execute statement
Author Adam
--- In firebird-support@yahoogroups.com, "Paul Mercea"
<paul.mercea@...> wrote:
>
> Hi
> When I try the procedure in procedure debugger it's working but when
I try
> to run I get error!!!
>
> PaulM

Paul,

There is no such thing as a procedure debugger for Firebird. Several
tools contain a 'procedure debugger' but it is actually a procedure
emulator. As with all emulators, there are cases where the behaviour
differs (either because of a bug in the real thing or a bug in the
emulator).

I think varchar(50) should be enough for this query, increase it for a
test, but are you sure loc_id is an integer and loc_name will fit in
varchar(30)?? Perhaps try explicitly casting in the query.

strsql='select cast(loc_id as integer), casr(loc_name as varchar(30)
from '||T;

(You will need to increase strsql obviously).

Also, password required is of interest. Have you granted your stored
procedure select access to the table you are passing in??

Adam



>
> -----Original Message-----
> From: firebird-support@yahoogroups.com
> [mailto:firebird-support@yahoogroups.com] On Behalf Of Paul Mercea
> Sent: Saturday, April 08, 2006 6:51 PM
> To: firebird-support@yahoogroups.com
> Subject: [firebird-support] Problem with Execute statement
>
> Hi
>
> I want to create generic procedure to execute sql statements passed as
> variable.
> I have made this test procedure to verify if is working:
>
> CREATE PROCEDURE T2 (
> T VARCHAR(20))
> RETURNS (
> IDN VARCHAR(30),
> IDL INTEGER)
> AS
> DECLARE VARIABLE STRSQL VARCHAR(50);
> begin
> strsql='select loc_id, loc_name from '||T;
> for execute statement :strsql into :idl, :idn do
> begin
> suspend;
> end
>
> end
>
> I pass table name (SYS_LOCATION) and I get this error message:
> "Variable type (position 0) in EXECUTE STATEMENT 'select loc_id,
loc_name
> from SY' INTO does not match returned column type.
> Password required"
> If I change strsql='select loc_id, loc_name from '||T||' '; I get
message:
> "Variable type (position 1) in EXECUTE ......"
> Same message if I modify like this:
> strsql='select loc_id, loc_name from ';
> for execute statement :strsql ||T into :idl, :idn do
>
> What I'm doing wrong????
>
> TIA
> PaulM
>
>
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Visit http://firebird.sourceforge.net and click the Resources item
> on the main (top) menu. Try Knowledgebase and FAQ links !
>
> Also search the knowledgebases at http://www.ibphoenix.com
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Yahoo! Groups Links
>