473,395 Members | 1,941 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Create Cursor from prepare statement!!!!

60
Hi Friends,
I want to create a cursor which will get filled up from a dynamic query. For example:

Expand|Select|Wrap|Line Numbers
  1. SET @sqlQuery := CONCAT('SELECT <field1> FROM <table> WHERE <field2> = <some_value>');
  2. PREPARE stmt FROM @sqlQuery;
Where <some_value> will be decided based on some input value to the procedure.

Can i create a cursor from the above PREPARE statement??

Thanks,
Lauren
Oct 13 '09 #1
1 5461
SLauren
60
I could be able to do this with the help of "View". I created a view by selecting the required columns from the dynamic query and then created the cursor from the view.

Thanks,
Lauren
Oct 14 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Peter Phelps | last post by:
My problem is as follows: I need automatically iterate through a single field in a table and use the values in the field to create an in-statement. Currently, the character limitation in the...
2
by: Rajat Katyal | last post by:
Hi: I prepare the statement for execution as follows: PREPARE query(text) as SELECT count(*) FROM transform_customer_billing where inv_no = $1; The problem is Iam not able to execute this...
3
by: howachen | last post by:
Hi, When doing mysql query (SELECT statements) in php, we often use prepare statement to prevent SQL injection. However, I just noticed that the prepare statements can SLOW the number of queries...
3
by: vbace2 | last post by:
Hi. I am using DB2 v9.1 fixpack 2. I was wondering if there is a way to use the with hold option when using the prepare statement. Or, is there another way that I can do what I need to? I...
1
by: AFBIII | last post by:
Is anyone aware of if the Prepare statement is limitted to the size of buffer you pass into it in regards to a dynamic SQL? we recently had a dynamic SQL hit 80,000 characters in length and now it...
1
by: Akino877 | last post by:
Hello, I have a small Perl program : #!/usr/bin/perl -w use DBI; use Mysql; $host = ""; $database = ""; $user = "root";
1
by: abdev | last post by:
Hi All, can i use user defined function in prepare statement? I am trying following, sprintf(c_stmt,"INSERT/*+ APPEND */ INTO %s VALUES(?,CHAR_TO_DATE(?,'DD-MON-YYYY')) WITH...
1
by: Massimiliano Campagnoli | last post by:
Hy, I am trying to understand how the prepare statement works. I am using Qt C++ library to access db2: { .... QSqlQuery cust_query; cust_query.prepare("SELECT CUST_NAME FROM CUSTOMERS...
0
by: ramilol | last post by:
i wanna create cursor but i have no idea how all i know is that ill use create cursor to do it but the last two paremters need a some 00xff values i have no idea how to use them can't i just draw...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.