473,761 Members | 3,542 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Oracle Cursor Problem

2 New Member
Hi All,

I have this strange problem. I am user of two different database (both are same version 9i). I created a procedure and within this procedure i used a cursor to select the values, this is working very fine.

When i copy this procedure in other database and try to run the procedure, the procedure runs successful, but the cursor does not populate the values, when i run the query written in the cursor, query returns the correct values.

Another interesting thing is that when i run the cursor not within procedure it runs successfully but when i try to use within procedure it does not work.

Another thing is that if i run the same procedure with cursor but omitting the where clause the procedure works fine again, but with where it does not populate the values in the cursor and cursor row count is = 0.

Anyone have the answer please.


CREATE OR REPLACE PROCEDURE proc_dps_check
as
PM_TABLE_NAMES VARCHAR2 (50);

CURSOR pmC IS SELECT LOWER(RTRIM(LTR IM(tname))) AS v_TABLENAME FROM dps_prc;-- WHERE LOWER(RTRIM(LTR IM(tname))) IN (SELECT LOWER(RTRIM(LTR IM(TABLE_NAME)) ) FROM ALL_TABLES WHERE OWNER = 'TEST');

BEGIN

FOR I IN PMC LOOP
Dbms_Output.PUT _LINE(I.v_TABLE NAME);
--Code goes here...
--COMMIT;
END LOOP;
END;


Thanks.
Jun 11 '07 #1
2 3880
BilalGhazi
2 New Member
HI ALL,

I HAVE FOUND THE PROBLEM, AND IM RESOLVING IT. THANKS


Hi All,

I have this strange problem. I am user of two different database (both are same version 9i). I created a procedure and within this procedure i used a cursor to select the values, this is working very fine.

When i copy this procedure in other database and try to run the procedure, the procedure runs successful, but the cursor does not populate the values, when i run the query written in the cursor, query returns the correct values.

Another interesting thing is that when i run the cursor not within procedure it runs successfully but when i try to use within procedure it does not work.

Another thing is that if i run the same procedure with cursor but omitting the where clause the procedure works fine again, but with where it does not populate the values in the cursor and cursor row count is = 0.

Anyone have the answer please.


CREATE OR REPLACE PROCEDURE proc_dps_check
as
PM_TABLE_NAMES VARCHAR2 (50);

CURSOR pmC IS SELECT LOWER(RTRIM(LTR IM(tname))) AS v_TABLENAME FROM dps_prc;-- WHERE LOWER(RTRIM(LTR IM(tname))) IN (SELECT LOWER(RTRIM(LTR IM(TABLE_NAME)) ) FROM ALL_TABLES WHERE OWNER = 'TEST');

BEGIN

FOR I IN PMC LOOP
Dbms_Output.PUT _LINE(I.v_TABLE NAME);
--Code goes here...
--COMMIT;
END LOOP;
END;


Thanks.
Jun 11 '07 #2
debasisdas
8,127 Recognized Expert Expert
Hi
BilalGhazi
Welcome to TSDN.

You have reached the right place for knowledge shairing.

Here you will find a vast resource of related topics and code.

Feel free to post more doubts/questions in the forum.

But before that give a try from your side and if possible try to post what/how you have approached to solve the problem.

It will help Experts in the forum in solving/underestanding your problem in a better way.

Please follow the posting guidelines in every new post/reply.
Jun 11 '07 #3

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

Similar topics

13
7480
by: Chris Botha | last post by:
The machine is running XP Pro with all the latest service packs, etc. I must access an Oracle database so I installed the Oracle client stuff. I can query Oracle from a Windows app, no problem. Using the exact same code (copy and paste) into a Web app I get the following error "Error while trying to retrieve text for error ORA-01019". Security I thought, so I use Impersonation on the Web site, then the aspnet_wp.exe crashes with "The...
2
3015
by: André Nobre | last post by:
I don't know if this is the right place to make this question, so, if isn't, let me know... I have an oracle package with some procedures, and i need to access one procedure using vb.net. The problem is that i really don't know what this oracle procedure will return to vb.net. If I execute this normally, like ADO.NET Store Procedure, i'll get a DataSet/DataTable? What should i pass as parameter to "cC1" (in out - procedure P_G_CLI_I8)?
6
2822
by: JV | last post by:
A ref cursor data type can obviously be returned as an output parameter of a stored procedure, but can an ASP.NET application call an oracle proc that uses a ref cursor as an input parameter? If so, how? What object do you pass as that parameter? We are using System.Data.OracleClient, but if necessary, we might be able to switch.
14
4443
by: peteh | last post by:
Hi All; We have many production jobs that "load from cursor" to a UDB/AIX 8.2 (with dpf) data warehouse from source tables residing Oracle 9i. Since Oracle dates are (roughly) equivalent to DB2 timestamps, we frequently use the date() function to "convert" from the Oracle date datatype to the DB2 date datatype. We have used this technique on over 20 Oracle tables for several months with no problem. One table in particular fails with a...
0
18037
debasisdas
by: debasisdas | last post by:
RESTRICTIONS ON CURSOR VARIABLES ================================= Currently, cursor variables are subject to the following restrictions: Cannot declare cursor variables in a package spec. CREATE PACKAGE emp_stuff AS TYPE EmpCurTyp IS REF CURSOR RETURN emp%ROWTYPE; emp_cv EmpCurTyp; -- not allowed END emp_stuff;
2
14247
by: Vinod Sadanandan | last post by:
All, Below listed are the new features in Oracle 11g ,please join me in this discussion to generate a testcase and analyze each of the listed features . Precompilers: Additional Array INSERT and SELECT Syntax Support by Pro*C/C++ and Pro*COBOL Precompilers: Dynamic SQL Statement Caching in Pro*C/C++ and Pro*COBOL Precompilers: Fix Execution Plan in Pro*C/C++ and Pro*COBOL Precompilers: Flexible B Area Length...
0
4814
debasisdas
by: debasisdas | last post by:
SAMPLE CODE TO SHOW USE OF REFCURSOR ======================================= EXAMPLE #1 ---------------------- declare --declare the fer cursor. type my_ref_cur_typ is ref cursor; --declare a variable of rec cursor type. my_ref_cur my_ref_cur_typ;
0
8043
debasisdas
by: debasisdas | last post by:
Cursor Variable Returning %ROWTYPE ----------------------------------------------------------- DECLARE TYPE TmpCurTyp IS REF CURSOR RETURN emp%ROWTYPE; tmp_cv TmpCurTyp;TYPE EmpCurTyp IS REF CURSOR RETURN tmp_cv%ROWTYPE; emp_cv EmpCurTyp; BEGIN NULL;
6
11810
by: t_rectenwald | last post by:
Hello, I attempting to execute an Oracle query, and write the results to a file in CSV format. To do so, I've done the following: import cx_Oracle db = cx_Oracle.connect('user/pass@DBSID') cursor = db.cursor() cursor.arraysize = 500 cursor.execute(sql)
0
2721
by: tickle | last post by:
Need to convert this PL/SQL script to Dynamic SQL Method 2 * copybook - celg02u3.sql SIR 24265 * * updates dt_deny for all rows in * * the removal_eligibility_link table for all persons * * in all stages associated with the victim who has * * has had a specific legal status change * EXEC SQL EXECUTE
0
9377
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10136
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9811
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8814
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7358
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5266
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5405
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3913
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2788
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.