dbTalk Databases Forums  

Re: RE: [Fwd: How do I pass a collection type to a prepared statement in [1829]

comp.databases.informix comp.databases.informix


Discuss Re: RE: [Fwd: How do I pass a collection type to a prepared statement in [1829] in the comp.databases.informix forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Jean Sagi
 
Posts: n/a

Default Re: RE: [Fwd: How do I pass a collection type to a prepared statement in [1829] - 09-11-2003 , 12:33 PM








I think the same, maybe in Informix-4gl 7.32 they are properly supported.

Chucho!

-----Original Message-----
From: "Scott O'Rourke" <SORourke (AT) eurolife (DOT) co.uk>
To: "Jean Sagi " <jeansagi (AT) myrealbox (DOT) com>
Date: Thu, 11 Sep 2003 10:18:46 +0100
Subject: RE: [Fwd: How do I pass a collection type to a prepared statement in [1829]



The only way I know how to do this is to dynamically build the string and prepare & declare it on the fly.
I don't think 4gl supports collection types.

Quote:
-----Original Message-----
From: Jean Sagi [mailto:jeansagi (AT) myrealbox (DOT) com]
Sent: 11 September 2003 05:57
To: ids (AT) iiug (DOT) org
Subject: [Fwd: How do I pass a collection type to a prepared
statement in [1829]




-------- Original Message --------
Subject: How do I pass a collection type to a prepared statement in
Informix-4gl 7.30?
Date: Fri, 05 Sep 2003 12:46:27 -0500
From: Jean Sagi <jeansagi (AT) myrealbox (DOT) com
To: informix-list (AT) iiug (DOT) org
CC: jeansagi (AT) myrealbox (DOT) com

I have some minor problem with a 4gl - Sql statement.
Maybe someone has addreesed it before:

Let say you have the following query:

select count(*)
from some_table
where field_code = 10
and field_color in ( "blue", "red", "color" )
into temp tx
with no log;

where table some_table exists and has a fields field_code and
field_color

let say that this query must be inside a 4gl program and you want to
prepare it and execute it:

let c_sel =
" select count(*) ",
" from some_table",
" where field_code = 10 ",
" and field_color in ( 'blue', 'red', 'color' ) ",
" into temp tx ",
" with no log "

prepare st_sel from c_sel
execute c_sel

NO problem...

Now you want the filter "field_code = 10" be dinamyc :

let c_sel =
" select count(*) ",
" from some_table",
" where field_code = ? ",
" and field_color in ( 'blue', 'red', 'color' ) ",
" into temp tx ",
" with no log "

prepare st_sel from c_sel
execute c_sel using 10

No problem

!!Now you want the filter "field_color in ( 'blue', 'red',
'color' )" be
dynamic

HOW DO YOU THAT?

I tried different approaches but none of the worked...

Ex:

let c_sel =
" select count(*) ",
" from some_table",
" where field_code = ? ",
" and field_color in ? ",
" into temp tx ",
" with no log "

prepare st_sel from c_sel
execute c_sel using 10, "('blue', 'red', 'color')"

abort with the following error:

Program stopped at "prog_name.4gl", line number xxx.
4GL run-time error number -9650.
Right hand side of IN expression must be a COLLECTION type.

BTW:

#finderr -9650
Message number -9650 not found.

What I can see is that the right expression must be of
collection type... so


How do I pass a collection type to a prepared statement in
Informix-4gl?



Chucho!

PD:

Operating System version : HP-UX serve-name B.11.00 U 9000/856
INFORMIX-4GL Version : 7.30.HC7

Jean Sagi
jeansagi (AT) myrealbox (DOT) com
jeansagi (AT) netscape (DOT) net




--


Atte,


Jesús Antonio Santos Giraldo
jeansagi (AT) myrealbox (DOT) com
jeansagi (AT) netscape (DOT) net



--------------------------------------------------------
Eurolife Assurance Group plc, Eurolife House, 16 St John Street, London, EC1M 4NT
Tel: 020-7454 1151 Fax: 020-7454 1277

www.eurolife.co.uk
Registered in England, number 2471313




This message (and any associated files) is intended only for the use of the individual or entity to which it is addressed and may contain information that is confidential, subject to copyright or constitutes a trade secret. If you are not the intended recipient you are hereby notified that any dissemination, copying or distribution of this message, or files associated with this message, is strictly prohibited. If you have received this message in error, please notify us immediately by replying to the message and deleting it from your computer. Messages sent to and from us may be monitored.

Internet communications cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. Therefore, we do not accept responsibility for any errors or omissions that are present in this message, or any attachment, that have arisen as a result of e-mail transmission. If verification is required, please request a hard-copy version. Any views or opinions presented are solely those of the author and do not necessarily represent those of the company.





Jean Sagi
jeansagi (AT) myrealbox (DOT) com
jeansagi (AT) netscape (DOT) net


sending to informix-list


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.