Cursor with two select
Hi everybody, I need help with this:
I have this PLSQL:
CREATE OR REPLACE FUNCTION ATAWEB_FN_GET_RESERVA_X_FOLIO(num_folio number)
return tipos.ref_cursor Is
resultados_cur tipos.ref_cursor;
Begin
open resultados_cur for
select
cen.des_flex centro_descripcion,
(select prev.convdescr from tarcconv prev where val.sinonimo_prevision=prev.convcodig) previsión
from atarese res, pers per1, especialid esp, pers per2, atatippac tipop, atapres atap, OPS$NUCLEO.GLO_CAC cen
, atavalrese val
, admtyc.tarcphos tarc
where res.folio = num_folio
return resultados_cur;
end;
I get an error in the line 08 (PLS-00103: Encountered the symbol "SELECT" when expecting one of the following).
I think it is due to the nested select i that line.
When I put the query in the sql editor there is no problem.
select
cen.des_flex centro_descripcion,
(select prev.convdescr from tarcconv prev where val.sinonimo_prevision=prev.convcodig) previsión
from atarese res, pers per1, especialid esp, pers per2, atatippac tipop, atapres atap, OPS$NUCLEO.GLO_CAC cen
, atavalrese val
, admtyc.tarcphos tarc
where res.folio = num_folio
I'm working with a Oracle 8i version because is a legacy database.
Many thanks in advance!
Hello SomeoneElse
I can rewrite the query like this:
select
cen.des_flex centro_descripcion,
prev.convdescr prevision
from atarese res, pers per1, especialid esp, pers per2, atatippac tipop, atapres atap, OPS$NUCLEO.GLO_CAC cen
, atavalrese val
, admtyc.tarcphos tarc
,tarcconv prev
where res.folio = num_folio
and val.sinonimo_prevision=prev.convcodig
But when I run explain plan (for query optimization) I have "INDEX FULL SCAN".
Explain plan: Using EXPLAIN PLAN
Similar Messages
-
HI
I want to create a cursor with a dynamic select, in other words, in the code,when i OPEN the cursor i want to change its query.
How can i do?
PS I have the 8.1.7Hi
Sorry my very bad english,
I would like to change the WHERE condition of my declared cursor, is there some method that allow me to pass a string in the quey condition?
How can i use REF CURSOR? -
For example, I will select the first image in my grid view, then let's say I want to work on the fifth image. When I click on the fifth image, Lightroom leaves image one selected, as if I have held down the Command or the Shift key to select multiple images. This is not what I expect. Then I am forced to command click the image I no longer want selected - this happens every time I try to move to any new image - the previous one(s) stay selected. I have tried a reboot of my machine but still this happens. Also, as a further bug, if I leave my grid with no images selected at all, after a few seconds Lightroom automatically selects the first two images in my library and highlights them - without my even pressing a key! This is really weird behaviour. It's really frustrating as I like to use my keyboard arrow keys to move through my library of images, but when Lightroom keeps two images selected it just ping pongs between those two images. I deselect and try to move on, and it again leaves the previous image selected! By the way - I am not in Compare mode while this is happening - just in standard browsing of the library... Help please!
kind regards,
oMacFor example, I will select the first image in my grid view, then let's say I want to work on the fifth image. When I click on the fifth image, Lightroom leaves image one selected, as if I have held down the Command or the Shift key to select multiple images. This is not what I expect. Then I am forced to command click the image I no longer want selected - this happens every time I try to move to any new image - the previous one(s) stay selected. I have tried a reboot of my machine but still this happens. Also, as a further bug, if I leave my grid with no images selected at all, after a few seconds Lightroom automatically selects the first two images in my library and highlights them - without my even pressing a key! This is really weird behaviour. It's really frustrating as I like to use my keyboard arrow keys to move through my library of images, but when Lightroom keeps two images selected it just ping pongs between those two images. I deselect and try to move on, and it again leaves the previous image selected! By the way - I am not in Compare mode while this is happening - just in standard browsing of the library... Help please!
kind regards,
oMac -
Report with two selection screen
Hi,
I have one requirement for report.
When we execute the report then it should have two parameter (sales org, document number)
After pressing F8 it should display another screen or same screen with display customer name, city for that document and screen should have 2 more parameters (New customer kunnr).after pressing F8 program functionality should work.
Please suggest.please create 2 reports as given below.-
REPORT ZSZP_00007.
parameters a(5) .
parameters b(5) .
parameters c(5) .
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF screen-name = 'A' or screen-name = 'B' .
get parameter id 'aaaaaaaaaaa' field a.
get parameter id 'bbbbbbbbbbb' field B.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
start-of-selection.
your logic
REPORT zszp_00005.
PARAMETERS a(5).
PARAMETERS b(5).
START-OF-SELECTION.
SET PARAMETER ID 'aaaaaaaaaaa' FIELD a.
SET PARAMETER ID 'bbbbbbbbbbb' FIELD b.
your logic
SUBMIT zszp_00007 VIA SELECTION-SCREEN.
i hope this approach will solve your problem.
thanks
Swanand -
How can I fill a table of objects from cursor with select * bulk collect???
Hi All, I have a TYPE as OBJECT
create or replace type dept2_o as object (
deptno NUMBER(2),
dname VARCHAR2(14),
loc VARCHAR2(13));
I can fill a table of objects from cursor with out select * bulk collect...., row by row
declare
TYPE dept2_t IS TABLE of dept2_o;
dept_o_tab dept2_t:=dept2_t();
i integer;
begin
i:=0;
dept_o_tab.extend(20);
for rec in (select * from dept) loop
i:=i+1;
dept_o_tab(i):=dept2_o(
deptno => rec.deptno,
dname => rec.dname,
loc =>rec.loc
end loop;
for k IN 1..i loop
dbms_output.put_line(dept_o_tab(k).deptno||' '||dept_o_tab(k).dname||' '||dept_o_tab(k).loc);
end loop;
end;
RESULT
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
But I can't fill a table of objects from cursor with select * bulk collect construction ...
declare
TYPE dept2_t IS TABLE of dept2_o;
dept_o_tab dept2_t:=dept2_t();
begin
dept_o_tab.extend(20);
select * bulk collect into dept_o_tab from dept;
end;
RESULT
ORA-06550: line 6, column 39;
PL/SQL: ORA-00947: not enough values ....
How can I fill a table of objects from cursor with select * bulk collect???create or replace type dept_ot as object (
deptno NUMBER(2),
dname VARCHAR2(14),
loc VARCHAR2(13));
create table dept
(deptno number
,dname varchar2(14)
,loc varchar2(13)
insert into dept values (10, 'x', 'xx');
insert into dept values (20, 'y', 'yy');
insert into dept values (30, 'z', 'zz');
select dept_ot (deptno, dname, loc)
from dept
create type dept_nt is table of dept_ot
declare
l_depts dept_nt;
begin
select dept_ot (deptno, dname, loc)
bulk collect
into l_depts
from dept
for i in l_depts.first .. l_depts.last
loop
dbms_output.put_line (l_depts(i).deptno);
dbms_output.put_line (l_depts(i).dname);
dbms_output.put_line (l_depts(i).loc);
end loop;
end;
/ -
Opening two cursors using open cursor with bulk collect on colections ..
Is it possible to have the implementatiion of using bulk collect with collections using two open cursors ..
first c1
second c2
open c1
loop
open c2
loop
end loop
close c2
end loop;
close c1
what i found is for every outer loop of cursor c1 , cursor c2 is open and closed for every record.
is this willl imporove the performace .?
EXAMPLE:-
NOTE: The relatoin between finc and minc is one to many ..finc is parent and minc is child
function chk_notnull_blank ( colname IN number ) return number is
BEGIN
if ( colname is NOT NULL and colname not in ( -8E14, -7E14, -6E14, -5E14, -4E14, -3E14, -2E14, -1E14, -1E9 )) then
RETURN colname ;
else
RETURN 0;
end if;
END chk_notnull_blank;
procedure Proc_AnnualFmlyTotIncSummary is
CURSOR c_cur_finc IS SELECT FAMID FROM FINC ;
CURSOR c_cur_minc IS SELECT FAMID, MEMBNO , ANFEDTX, ANGOVRTX, ANPRVPNX, ANRRDEDX, ANSLTX, SALARYX, SALARYBX, NONFARMX, NONFRMBX , FARMINCX, FRMINCBX, RRRETIRX, RRRETRBX, SOCRRX, INDRETX, JSSDEDX, SSIX, SSIBX from MINC minc WHERE FAMID IN ( SELECT FAMID FROM FINC finc WHERE minc.FAMID = finc.FAMID );
v_tot_fsalaryx number := 0;
v_tot_fnonfrmx number := 0;
v_tot_ffrmincx number := 0;
v_tot_frretirx number := 0;
v_tot_findretx number := 0;
v_tot_fjssdedx number := 0;
v_tot_fssix number := 0;
v_temp_sum_fsalaryx number := 0;
v_temp_sum_fnonfrmx number := 0;
v_temp_sum_ffrmincx number := 0;
v_temp_sum_frretirx number := 0;
v_temp_sum_findretx number := 0;
v_temp_sum_fjssdedx number := 0;
v_temp_sum_fssix number := 0;
TYPE minc_rec IS RECORD (FAMID MINC.FAMID%TYPE, MEMBNO MINC.MEMBNO%TYPE , ANFEDTX MINC.ANFEDTX%TYPE, ANGOVRTX MINC.ANGOVRTX%TYPE , ANPRVPNX MINC.ANPRVPNX%TYPE , ANRRDEDX MINC.ANRRDEDX%TYPE , ANSLTX MINC.ANSLTX%TYPE, SALARYX MINC.SALARYX%TYPE , SALARYBX MINC.SALARYBX%TYPE , NONFARMX MINC.NONFARMX%TYPE , NONFRMBX MINC.NONFRMBX%TYPE, FARMINCX MINC.FARMINCX%TYPE , FRMINCBX MINC.FRMINCBX%TYPE , RRRETIRX MINC.RRRETIRX%TYPE , RRRETRBX MINC.RRRETRBX%TYPE, SOCRRX MINC.SOCRRX%TYPE , INDRETX MINC.INDRETX%TYPE , JSSDEDX MINC.JSSDEDX%TYPE , SSIX MINC.SSIX%TYPE , SSIBX MINC.SSIBX%TYPE );
v_flag_boolean boolean := false;
v_famid number ;
v_stmt varchar2(3200) ;
v_limit number := 50;
v_temp_FAMTFEDX number := 0 ;
v_temp_FGOVRETX number := 0 ;
v_temp_FPRIVPENX number := 0 ;
v_temp_FRRDEDX number := 0 ;
v_temp_FSLTAXX number := 0 ;
v_temp_FSALARYX number := 0 ;
v_temp_FNONFRMX number := 0 ;
v_temp_FFRMINCX number := 0 ;
v_temp_FRRETIRX number := 0 ;
v_temp_FINDRETX number := 0 ;
v_temp_FJSSDEDX number := 0 ;
v_temp_FSSIX number := 0 ;
BEGIN
OPEN c_cur_finc ;
LOOP
FETCH c_cur_finc BULK COLLECT INTO famid_type_tbl LIMIT v_limit;
EXIT WHEN famid_type_tbl.COUNT = 0;
FOR i in famid_type_tbl.FIRST..famid_type_tbl.LAST
LOOP
OPEN c_cur_minc ;
LOOP
FETCH c_cur_minc BULK COLLECT INTO minc_rec_type_tbl LIMIT v_limit;
EXIT WHEN minc_rec_type_tbl.COUNT = 0;
FOR j IN minc_rec_type_tbl.FIRST..minc_rec_type_tbl.LAST
LOOP
if ( famid_type_tbl(i) = minc_rec_type_tbl(j).FAMID ) THEN
v_temp_FAMTFEDX := v_temp_FAMTFEDX + chk_notnull_blank(minc_rec_type_tbl(j).ANFEDTX );
v_temp_FGOVRETX := v_temp_FGOVRETX + chk_notnull_blank(minc_rec_type_tbl(j).ANGOVRTX);
v_temp_FPRIPENX := v_temp_FPRIPENX + chk_notnull_blank(minc_rec_type_tbl(j).ANPRVPNX);
v_temp_FRRDEDX := v_temp_FRRDEDX + chk_notnull_blank(minc_rec_type_tbl(j).ANRRDEDX);
v_temp_FSLTAXX := v_temp_FSLTAXX + chk_notnull_blank(minc_rec_type_tbl(j).ANSLTX );
v_temp_FSALARYX := v_temp_FSALARYX + chk_notnull_blank(minc_rec_type_tbl(j).SALARYX ) + chk_notnull_blank(minc_rec_type_tbl(j).SALARYBX);
v_temp_FNONFRMX := v_temp_FNONFRMX + chk_notnull_blank(minc_rec_type_tbl(j).NONFARMX) + chk_notnull_blank(minc_rec_type_tbl(j).NONFRMBX);
v_temp_FFRMINCX := v_temp_FFRMINCX + chk_notnull_blank(minc_rec_type_tbl(j).FARMINCX) + chk_notnull_blank(minc_rec_type_tbl(j).FRMINCBX );
v_temp_FRRETIRX := v_temp_FRRETIRX + chk_notnull_blank(minc_rec_type_tbl(j).RRRETIRX) + chk_notnull_blank(minc_rec_type_tbl(j).RRRETRBX ) + chk_notnull_blank(minc_rec_type_tbl(j).SOCRRX);
v_temp_FINDREXT := v_temp_FINDRETX + chk_notnull_blank(minc_rec_type_tbl(j).INDRETX);
v_temp_FJSSDEDX := v_temp_FJSSDEDX + chk_notnull_blank(minc_rec_type_tbl(j).JSSDEDX);
v_temp_FSSIX := v_temp_FSSIX + chk_notnull_blank(minc_rec_type_tbl(j).SSIX ) + chk_notnull_blank(minc_rec_type_tbl(j).SSIBX);
END IF;
END LOOP;
END LOOP ;
CLOSE c_cur_minc;
UPDATE FINC SET FAMTFEDX = v_temp_FAMTFEDX WHERE FAMID = famid_type_tbl(i);
END LOOP;
END LOOP;
CLOSE c_cur_finc;
END;
EXCEPTION
WHEN OTHERS THEN
raise_application_error(-20001,'An error was encountered - '||SQLCODE||' -ERROR- '||SQLERRM);
v_err_code := SQLCODE;
v_err_msg := substr(SQLERRM, 1, 200);
INSERT INTO audit_table (error_number, error_message) VALUES (v_err_code, v_err_msg);
error_logging(p_error_code => substr(sqlerrm,1,9), p_error_message => substr(sqlerrm,12), p_package =>'PKG_FCI_APP',p_procedure => 'Proc_Annual_Deductions_FromPay ' , p_location => v_location);
end Proc_AnnualFmlyTotIncSummary ;
Is the proga efficient and free from compilation errors ..?
thanks/kumar
Edited by: kumar73 on Sep 22, 2010 12:48 PMfunction chk_notnull_blank ( colname IN number ) return number is Maybe this function should have its own forum:
how to use case in this program
Re: how to declare a formal parameter in a function of type record and access ?
Re: how to define a function with table type parameter
Re: creation of db trigger with error ..
Re: How to write a trigger for the below scenario
how to improve the code using advanced methods
yours advice in improving the coding ..
How to use bulk in multiple cursors !!
;-) -
How to create a selection screen with two tab strips
Hi Experts,
I need to craete a selection screen '100' with two tab strips, in the 1st tab strip i need create some select options as subscreen and in other tabstrip i need to call the subscren '4000' of the program 'SAPLCTMS' . i need to call this screen as selection screen from the zprogram. please help me out.
Thanks in advance...
Sarath...JHi,
I have developed some code.
It just displays a table control and after entering the values init, upon hitting the return button, the values will be put into table itab. Have a look and make necessary changes as you see fit.
*& Report ZMADHU_TBCNTL
REPORT zmadhu_tbcntl.
DATA: BEGIN OF itab OCCURS 0,
sel TYPE s_flag,
matnr TYPE matnr,
ersda TYPE ersda,
ernam TYPE ernam,
END OF itab.
CONTROLS: tab_cntl TYPE TABLEVIEW USING SCREEN 100.
*START-OF-SELECTION.
CALL SCREEN 100.
*END-OF-SELECTION.
*& Module STATUS_0100 OUTPUT
text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'TABCNTL'. "pf status
SET TITLEBAR 'xxx'.
CASE sy-ucomm.
WHEN 'BACK' OR
'CANCEL' OR
'EXIT'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module ITAB_MODIFY INPUT
text
MODULE itab_modify INPUT.
CASE sy-ucomm .
WHEN ' '. " When pressed enter
if itab-sel = 'X'.
MODIFY itab INDEX tab_cntl-current_line.
APPEND itab. " append lines to internal table
CLEAR itab.
*endif.
ENDCASE.
ENDMODULE. " ITAB_MODIFY INPUT
*Screen 100 flow logic.
PROCESS BEFORE OUTPUT.
MODULE status_0100.
LOOP AT itab WITH CONTROL tab_cntl CURSOR
tab_cntl-current_line..
ENDLOOP.
PROCESS AFTER INPUT.
MODULE select_data.
LOOP .
CHAIN.
FIELD itab-matnr.
FIELD itab-ersda.
FIELD itab-ernam.
MODULE itab_modify ON CHAIN-REQUEST.
ENDCHAIN.
ENDLOOP.
MODULE USER_COMMAND_0100.
Hope it will helps to u.
Thanks,
Shankar -
Cursor in if statement with two sql statements
if
:v_project_number ='ALL'
then
cursor c1 is select * from gl_je_lines gjl
where nvl(gjl.attribute10,1) in(select decode(:v_project_number,'ALL',nvl(gjl.attribute10,1),:v_project_number) from dual)
else if
:v_project_number !='ALL'
then
cursor c1 is select * from gl_je_lines gjl
end if;
this is giving error can any one help me to achive above requirementHi,
No need for 'if then' modify your cursor as follows:
cursor c1 is select * from gl_je_lines gjl
where decode(:v_project_number,'ALL','A',nvl(gjl.attribute10,1)) =decode(:v_project_number,'ALL','A',:v_project_number);
if :v_project_number is 'ALL' then it checks the character 'A' in both the side so the query returns all rows. On the other hand if :v_project_number is not equeal to 'ALL' strictly it compares the contents of gjl.attribute10 with :v_project_number. -
Field in the selection screen as a select option with two default values
Hi All,
can anybody tell me how to put field in the selection screen with two defaul values.
for ex: selection screen the Account Group KNA1-KTOKD as a select option. The defeault value should be Y001 and Y005.
please reply ASAP. Its urgent.
Thanks in advance,
MadhuHi Madhu,
Since Select options are nothing but ranges, you can use the following code to add two distinct values to the select options by default.
s_ktokd-sign = 'I'.
s_ktokd-option = 'EQ'.
s_ktokd-low = 'Y001'.
append s_ktokd.
s_ktokd-low = 'Y005'.
append s_ktokd.
clear s_ktokd.
However, if you want to mention a range like all the values between these given two values to be considered then u may use,
select-options : s_ktokd for KNA1-KTOKD default 'Y001' to 'Y005'.
or
s_ktokd-sign = 'I'.
s_ktokd-option = 'BT'.
s_ktokd-low = 'Y001'.
s_ktokd-high = 'Y005'.
append s_ktokd.
Reward if helpful. -
Delta with two different selection criteria
I have crated two Delta DTPs with different selection criteria (one with Flag = Y and Flag = N).
With flag = Y selection I have 100 records and flag = N, I have 50 records.
When I ran first Delta DTP (flag = Y), I got 100 records. Delta DTP worked fine.
But when I ran 2nd DTP (with flag = Y), 50 records tranferred but no records added.
Is it possible to have two delta DTPs with different selection criteria?
Thanks,
PV
Edited by: P V on Aug 23, 2009 4:58 AMHi.
I guess there was a typo error in your query,
"When I ran first Delta DTP (flag = Y), I got 100 records. Delta DTP worked fine.
But when I ran 2nd DTP (with flag = Y), 50 records tranferred but no records added."
I guess it should be,
"When I ran first Delta DTP (flag = Y), I got 100 records. Delta DTP worked fine.
But when I ran 2nd DTP (with flag = N), 50 records tranferred but no records added."
Yes, two Delta DTPs with different selection conditions can be used.
Can you please check with the availability of 50 records with FLAG = N in the target InfoProvider?
If the 50 records with FLAG = N loaded through delta already exists in the target InfoProvider,
then no addition will occur though trasfer will take place.
Regards.
VJ -
Cursor does not change with tool selection
Has anybody experienced this? My cursor suddenly does not change with the selection of tools when working on photos. Once I roll over the picture the arrow is lost and becomes a strange 3 small things, so can't do any work accurately. Still using PS 7 in Win 7. This was not a problem previously. Already uninstalled and reinstalled and problem is still there. I have searched for where this can be fixed. So far no luck. Any suggestions?
First answer, PS 7, not Elements. Second answer, BIG THANKS, the dpi change corrected the problem.
It was an odd issue as PS was working fine for years and then suddenly the problem occured, even though I had not changed the dpi recently.
A true glitch. Thanks again for the fix. Working fine again. -
How to show two seperate pivot tables with one select column
Hi All
My client wishes to have two pivot tables, one showing positive results and the other showing negative results.
For Example:
DIMENSION
BUSINESS A 1000
BUSINESS B 500
BUSINESS C 100
DIMENSION
BUSINESS A -1000
BUSINESS B -500
BUSINESS C -100
Is it possible to then select the different DIMENSION with one select column for both?
ThanksNot sure I got it right try this
for Number column pull twice and set col*-1
use 2 pivot table for each number type
cool as ~ http://cool-bi.com -
Two selection screen problem in one report
i have a two selection screens 1000 & 2000 in single report , which needs to be executed one after the other ,
the problem is when i execute second selection screen(2000) , the cursor is going back to at-selection-screen once again.
but i need to trigger start-of-selection directly after executing second selection screen,
the first selection screen 1000 will be executed with the help of select options..
the sample code is below .
at-selection-screen.
perform validations.
call selection screen 2000.
at selection screen on value request p_adm
start-of-selection.
main logicModerator message - Cross post locked
Rob -
Photo shop is not allowing me to use the "Intersect with current selection"
Photoshop is not allowing me to use the "Itersect with current selection" marquee. (The "UNION" between two selection marquees.) When I press the [Shift] + [Option] keys while dragging on a first selection marquee, this just creates a new selection and removes the old selection. I have also tried using the "intersect with selection" icon which is not working either.
Lack of experience possibly'.
To get the 360 degree scroll you need to be 'zoomed in' closer (than 1:1) to a picture or web page so that it is too large to fit on your screen.
As you know, with Windows you need, at all times' to scroll the bars at the bottom and/or right of the screen to move the display around (a little like an altazimuth telescope is manouvred). Also, if you accidently leave the scroll bar when dragging, the screen immediately snaps back to where you started from rather than knowing how far down you got before your cursor moved off the bar (if it did). You are certain to know what I mean.
If you are similarly 'zoomed in' to a picture on your new Mac, you don't necessarily need to click and drag on the scroll bars at the bottom (or right) of the window, or use the scroll wheel to move the screen vertically. With your Mac, when zoomed in to a greater than 100%, the mouse allows one toscroll 360 degrees with the mouse - not just vertically. But the picture (or web page needs to be zoomed in somewhat - i.e. greater than 1:1)
With Web pages in Safari and any other Web Browser (with the possible exception of IE with which I have had no experience with sometime before 2002 and I have only 'heard' that it doesn't work ), if you use the keys 'cmd and '+" together.
At he end of the day, you just need to keep exploring your new Mac and have fun finfing all the added extras for yourself.
(There's do many little treasures, it just gettng the time to find them all, in my experience.) -
PL/SQL cursor with FOR UPDATE STATEMENT
Welcome,
I have some troubles with cursors. When I try update values in table using cursor i receive ORA-01410 Error : "INVALID ROWID".
I use code as below:
ALTER SESSION SET CURRENT_SCHEMA=TEST_SCHEMA;
DECLARE
TYPE LogTable_typ IS TABLE OF ADMIN_FILE_LOG%ROWTYPE;
v_ModuleId KTIMS.ADMIN_FILE_LOG.MODULE_ID%TYPE;
v_CDR KTIMS.ADMIN_FILE_LOG.CDR_SUCCESS%TYPE;
CURSOR c1 IS
SELECT MODULE_ID, cdr_success FROM ADMIN_FILE_LOG
FOR UPDATE OF CDR_SUCCESS NOWAIT;
BEGIN
OPEN c1;
LOOP
FETCH c1 INTO v_ModuleId,v_CDR;
IF v_ModuleId = 'LOAD' THEN
UPDATE ADMIN_FILE_LOG SET CDR_SUCCESS = 70 WHERE CURRENT OF c1;
END IF;
EXIT WHEN c1%NOTFOUND;
END LOOP;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE(SQLERRM || SQLCODE);
END;
When I use ROWID in cursor declaration all works fine.Working code is:
ALTER SESSION SET CURRENT_SCHEMA=KTIMS;
DECLARE
TYPE LogTable_typ IS TABLE OF ADMIN_FILE_LOG%ROWTYPE;
v_ModuleId KTIMS.ADMIN_FILE_LOG.MODULE_ID%TYPE;
v_CDR KTIMS.ADMIN_FILE_LOG.CDR_SUCCESS%TYPE;
v_id ROWID;
CURSOR c1 IS
SELECT MODULE_ID, cdr_success, ROWID FROM ADMIN_FILE_LOG
FOR UPDATE OF CDR_SUCCESS NOWAIT;
BEGIN
OPEN c1;
LOOP
FETCH c1 INTO v_ModuleId,v_CDR,v_id;
IF v_ModuleId = 'LOAD' THEN
UPDATE ADMIN_FILE_LOG SET CDR_SUCCESS = 70 WHERE ROWID = v_id;
END IF;
EXIT WHEN c1%NOTFOUND;
END LOOP;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE(SQLERRM || SQLCODE);
END;
What is difference in this two cases ?
I try to find this in Oracle documentation "Database PL/SQL User's Guide and Reference" ( http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/sqloperations.htm#i45288 ).
Please help.Hi,
I think the USE of NOWAIT clause in cursor for update is, to remove the lock immediately after the transaction is over.
In the second example where you are fetching the rowid explicitly and use the same id in loop to make the update, so there should not be any problem in this case.
In the first example when you are using CURRENT OF to do the update, it is basically work on basis of latest fetched row from cursor and do the update (but i think implicitly it use the reference of row id also).
I am not sure about it , but still try once by removing the NOWAIT clause from your cursor for update and try once , see whether you are still facing the error or not.
Maybe you are looking for
-
Dual Screen ThinkPad W520 with docking station
I'm trying to use an external monitor with my docking station to extend my desktop but I can't get it to work. I'm using the intel HD video card and I already followed thoses guide https://wiki.archlinux.org/index.php/Intel https://wiki.archlinux.org
-
BDX1100 Blu Ray player won't connect to 50HM66 DLP TV via HDMI
Hi all. I have been trying to connect my Toshiba BDX1100 Blu Ray player to my Toshiba 50HM66 DLP TV through the HDMI. I have tried both HDMI 1 & 2 ports. I have tried 3 different cables. The Blu Ray player connects through HDMI on another TV so I
-
My son got an iPod Shuffle today for his birthday and a iTunes gift card. The Shuffle worked great at first. He immediately downloaded about 11 songs and everything was working fine. Then he decided to look for a few more songs and now we can't seem
-
Link with Work Centre and Order Number?
Can anybody give me a link between the Work center(CRHD-ARBPL) and Order Number(AUFK-AUFNR)? Regards, Subhasish
-
Configuring BI on Existing ECC 6.0 System
Hi All, We have an ECC6.0 system and currently there is a requirement to configure BI, can any one share the experience of doing it. I think we need to Install the BI_CONT addin and are there any taks involved after it? Regards, Ershad Ahmed