Or use:
dyn_stmt := 'Select id, manufacturer
From dns_manufacturers
Where UPPER(manufacturer) LIKE UPPER(:manufacturer_val)';
AND :
open return_cursor for dyn_stmt USING mnfctr;
Regards,
Vikas
Main Topics
Browse All TopicsHi
I've seen examples of this all over the place, but i can't seem to get it to work for me.
I'm using oracle 8.1.7 on (i think a solaris machine)
with my 8i client and apache on Red Hat 7.3
I created a dynamic sql query and i want to execute it and return the results in a cursor.
I've defined return_cursor as a "weak cursor", here is a sample code:
procedure get_manufacturers
( mnfctr IN dns_manufacturers.manufact
return_cursor OUT t_cursor,
errmsg OUT varchar2)
IS
dyn_stmt varchar2(200);
BEGIN
dyn_stmt := 'Select id, manufacturer
From dns_manufacturers
Where UPPER(manufacturer) LIKE UPPER(mnfctr)';
errmsg := dyn_stmt;
open return_cursor for dyn_stmt;
end get_manufacturers;
which when executed with PHP gives the following error:
Warning: OCIStmtExecute: ORA-00904: invalid column name ORA-06512: at "DNS.DNS_SELECTS_PKG", line 323 ORA-06512:
(line 323 is "open return....")
when i use:
procedure get_manufacturers
( mnfctr IN dns_manufacturers.manufact
return_cursor OUT t_cursor,
errmsg OUT varchar2)
IS
dyn_stmt varchar2(200);
BEGIN
dyn_stmt := 'Select id, manufacturer
From dns_manufacturers
Where UPPER(manufacturer) LIKE UPPER(mnfctr)';
errmsg := dyn_stmt;
Select id, manufacturer
From dns_manufacturers
Where UPPER(manufacturer) LIKE UPPER(mnfctr);
end get_manufacturers;
The procedure works fine, and when i print "errmsg" (which contains the dyn_stmt) it is displayed correctly, so my dyn_stmt is being created.
Any help would be appreciated.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: Vikas_DixitPosted on 2004-03-16 at 13:07:39ID: 10610083
I guess you need to change the following
dyn_stmt := 'Select id, manufacturer
From dns_manufacturers
Where UPPER(manufacturer) LIKE UPPER(mnfctr)';
to
dyn_stmt := 'Select id, manufacturer
From dns_manufacturers
Where UPPER(manufacturer) LIKE UPPER('||mnfctr||')';
Regards,
Vikas