Question on Parameter Markers

Vijayababu Sriramulu

Question on Parameter Markers
Hi,

I am using a dynamic SQL to explain some of my SQL's. In my SQL to be
explained, i have parameter markers. When i try to do the explain, db2
returns an SQL code of -104 saying

ILLEGAL SYMBOL "?". SOME SYMBOLS THAT MIGHT BE LEGAL ARE: : <IDENTIFIER>.

The actual SQL i tried to execute dynamically is

EXPLAIN ALL SET QUERYNO = 0001 FOR SELECT CURRENT_TIMESTAMP INTO ? FROM
SYSIBM.SYSDUMMY1 WITH UR

This is only a sample SQL. I know its not of much help to EXPLAIN this SQL.
But the point is, how can i get rid of this problem. I have
DYNAMICRULES(RUN) as my BIND option.

Can someone give me a helping hand in this.

Thanks & Regards
Vijay


********************************************
This electronic mail message is intended solely for the named recipients
and may contain confidential and proprietary business information of eFunds
Corporation and all its subsidiaries. If you are not a named recipient,
please notify the sender immediately. You may not disclose the contents to
any other person; use this electronic mail message or its contents for any
other purpose; or further store or copy its contents in any medium.
********************************************



Isaac Yassin

Re: Question on Parameter Markers
(in response to Vijayababu Sriramulu)
Hi
Get rid of the "into ?" part
Isaac Yassin
[login to unmask email]
----- Original Message -----
From: "Vijayababu Sriramulu" <[login to unmask email]>
Newsgroups: bit.listserv.db2-l
To: <[login to unmask email]>
Sent: Friday, December 21, 2001 10:12 AM
Subject: Question on Parameter Markers


> Hi,
>
> I am using a dynamic SQL to explain some of my SQL's. In my SQL to be
> explained, i have parameter markers. When i try to do the explain, db2
> returns an SQL code of -104 saying
>
> ILLEGAL SYMBOL "?". SOME SYMBOLS THAT MIGHT BE LEGAL ARE: : <IDENTIFIER>.
>
> The actual SQL i tried to execute dynamically is
>
> EXPLAIN ALL SET QUERYNO = 0001 FOR SELECT CURRENT_TIMESTAMP INTO ? FROM
> SYSIBM.SYSDUMMY1 WITH UR
>
> This is only a sample SQL. I know its not of much help to EXPLAIN this SQL.
> But the point is, how can i get rid of this problem. I have
> DYNAMICRULES(RUN) as my BIND option.
>
> Can someone give me a helping hand in this.
>
> Thanks & Regards
> Vijay
>
>
> ********************************************
> This electronic mail message is intended solely for the named recipients
> and may contain confidential and proprietary business information of eFunds
> Corporation and all its subsidiaries. If you are not a named recipient,
> please notify the sender immediately. You may not disclose the contents to
> any other person; use this electronic mail message or its contents for any
> other purpose; or further store or copy its contents in any medium.
> ********************************************
>
>
> DB2-L webpage at http://www.ryci.com/db2-l. The
owners of the list can
>



Patrick Hignett

Re: Question on Parameter Markers
(in response to Isaac Yassin)
Try replacing the ? with :X for a host variable name

Vijayababu Sriramulu wrote:

> Hi,
>
> I am using a dynamic SQL to explain some of my SQL's. In my SQL to be
> explained, i have parameter markers. When i try to do the explain, db2
> returns an SQL code of -104 saying
>
> ILLEGAL SYMBOL "?". SOME SYMBOLS THAT MIGHT BE LEGAL ARE: : <IDENTIFIER>.
>
> The actual SQL i tried to execute dynamically is
>
> EXPLAIN ALL SET QUERYNO = 0001 FOR SELECT CURRENT_TIMESTAMP INTO ? FROM
> SYSIBM.SYSDUMMY1 WITH UR
>
> This is only a sample SQL. I know its not of much help to EXPLAIN this SQL.
> But the point is, how can i get rid of this problem. I have
> DYNAMICRULES(RUN) as my BIND option.
>
> Can someone give me a helping hand in this.
>
> Thanks & Regards
> Vijay
>
> ********************************************
> This electronic mail message is intended solely for the named recipients
> and may contain confidential and proprietary business information of eFunds
> Corporation and all its subsidiaries. If you are not a named recipient,
> please notify the sender immediately. You may not disclose the contents to
> any other person; use this electronic mail message or its contents for any
> other purpose; or further store or copy its contents in any medium.
> ********************************************
>
>
>

Phil Grainger

Re: Question on Parameter Markers
(in response to Patrick Hignett)
or just remove the INTO clause altogether

Phil Grainger
Computer Associates
Product Manager, DB2
Tel: +44 (0)161 928 9334
Fax: +44 (0)161 941 3775
Mobile: +44 (0)7970 125 752
[login to unmask email]

-----Original Message-----
From: Patrick Hignett [mailto:[login to unmask email]
Sent: 21 December 2001 10:16
To: [login to unmask email]
Subject: Re: [DB2-L] Question on Parameter Markers


Try replacing the ? with :X for a host variable name

Vijayababu Sriramulu wrote:


Hi,

I am using a dynamic SQL to explain some of my SQL's. In my SQL to be
explained, i have parameter markers. When i try to do the explain, db2
returns an SQL code of -104 saying


ILLEGAL SYMBOL "?". SOME SYMBOLS THAT MIGHT BE LEGAL ARE: : <IDENTIFIER>.


The actual SQL i tried to execute dynamically is


EXPLAIN ALL SET QUERYNO = 0001 FOR SELECT CURRENT_TIMESTAMP INTO ? FROM
SYSIBM.SYSDUMMY1 WITH UR


This is only a sample SQL. I know its not of much help to EXPLAIN this SQL.
But the point is, how can i get rid of this problem. I have
DYNAMICRULES(RUN) as my BIND option.


Can someone give me a helping hand in this.


Thanks & Regards
Vijay


********************************************
This electronic mail message is intended solely for the named recipients
and may contain confidential and proprietary business information of eFunds
Corporation and all its subsidiaries. If you are not a named recipient,
please notify the sender immediately. You may not disclose the contents to
any other person; use this electronic mail message or its contents for any
other purpose; or further store or copy its contents in any medium.
********************************************




DB2-L webpage at http://www.ryci.com/db2-l < http://www.ryci.com/db2-l > . The
owners of the list can

James Campbell

Re: Question on Parameter Markers
(in response to Phil Grainger)
"If EXPLAIN is dynamically prepared, the statement can contain
parameter markers." (SQL Reference)

So I guess [I've never done this myself] you need something like:

01 MY-STMT.
05 MY-STMT-LEN PIC S9(4) COMP.
05 MY-STMT-DATA PIC X(1000).

MOVE 1 TO MY-STMT-LEN
STRING "EXPLAIN ALL SET QUERYNO = 0001 FOR SELECT "
" CURRENT_TIMESTAMP INTO ? FROM "
" SYSIBM.SYSDUMMY1 WITH UR "
DELIMITED BY SIZE
POINTER MY-STSMT-LEN
END-STRING
SUBTRACT 1 FROM MY-STMT-LEN

EXEC SQL
PREPARE SQL_STMT FROM MY-STMT
END-EXEC

(BUILD my-sqlda)

EXEC SQL
EXECUTE SQL_STMT USING DESCRIPTOR MY-SQLDA
END-EXEC

James Campbell

On 21 Dec 2001, at 13:42, Vijayababu Sriramulu wrote:

Date sent: Fri, 21 Dec 2001 13:42:35 +0530
Send reply to: DB2 Data Base Discussion List <[login to unmask email]>
From: Vijayababu Sriramulu <[login to unmask email]>
Subject: [DB2-L] Question on Parameter Markers
To: [login to unmask email]

> Hi,
>
> I am using a dynamic SQL to explain some of my SQL's. In my SQL to be
> explained, i have parameter markers. When i try to do the explain, db2
> returns an SQL code of -104 saying
>
> ILLEGAL SYMBOL "?". SOME SYMBOLS THAT MIGHT BE LEGAL ARE: : <IDENTIFIER>.
>
> The actual SQL i tried to execute dynamically is
>
> EXPLAIN ALL SET QUERYNO = 0001 FOR SELECT CURRENT_TIMESTAMP INTO ? FROM
> SYSIBM.SYSDUMMY1 WITH UR
>
> This is only a sample SQL. I know its not of much help to EXPLAIN this SQL.
> But the point is, how can i get rid of this problem. I have
> DYNAMICRULES(RUN) as my BIND option.
>
> Can someone give me a helping hand in this.
>
> Thanks & Regards
> Vijay
>
>
> ********************************************
> This electronic mail message is intended solely for the named recipients
> and may contain confidential and proprietary business information of eFunds
> Corporation and all its subsidiaries. If you are not a named recipient,
> please notify the sender immediately. You may not disclose the contents to
> any other person; use this electronic mail message or its contents for any
> other purpose; or further store or copy its contents in any medium.
> ********************************************
>
>
> DB2-L webpage at htt
p://www.ryci.com/db2-l. The owners of the list can


James A Campbell