What's not in the pl/sql block

Hi, I am unable to pass the parameter of a cursor to other cursors.
create table temp3 as select * from dept;

create table temp4 as select * from emp;


create or replace procedure xx_rep is

cursor xx_dep_cur is select deptno from dept;

cursor xx_emp_cur(p_dept number)
 is  select sal,comm from temp4 where deptno =p_dept;

   TYPE idt_cur_dep2 IS TABLE OF xx_dep_cur%ROWTYPE
              INDEX BY PLS_INTEGER;
       t_idt_cur_dep2       idt_cur_dep2;


 TYPE idt_cur_emp2 IS TABLE OF xx_emp_cur(p_dept number)%ROWTYPE
              INDEX BY PLS_INTEGER;
       t_idt_cur_emp2      idt_cur_emp2;



BEGIN
OPEN xx_dep_cur;
LOOP
FETCH xx_dep_cur
   BULK COLLECT INTO t_idt_cur_dep2 LIMIT 1000;

EXIT WHEN t_idt_cur_dep2.count<=0;

FOR indx in t_idt_cur_dep2.first .. t_idt_cur_dep2.last LOOP

DELETE  from temp3 where deptno=t_idt_cur_dep2(indx).deptno;


--main update

BEGIN
OPEN xx_emp_cur(t_idt_cur_dep2(indx).deptno);
LOOP
FETCH xx_emp_cur
   BULK COLLECT INTO t_idt_cur_emp2 LIMIT 1000;

EXIT WHEN t_idt_cur_emp2.count<=0;

FOR indx in t_idt_cur_emp2.first .. t_idt_cur_emp2.last LOOP

UPDATE temp4 set 
comm=10 , sal =100  where deptno=t_idt_cur_dep2(indx).deptno;

END LOOP;
END LOOP;
close xx_emp_cur(t_idt_cur_dep2(indx).deptno);
 EXCEPTION
        WHEN OTHERS
            THEN
                dbms_output.put_line('Exception' || SQLCODE||' '|| SQLERRM);
      END;
     


--end of main update
END LOOP;
END LOOP;
 COMMIT;
Close xx_dep_cur;
   
 EXCEPTION
        WHEN OTHERS
            THEN
                 dbms_output.put_line('Exception'|| SQLCODE||' '|| SQLERRM);
      END;
     

You have syntax errors and when you set the couple noticed that you will find a little more.

First place a
/
display errors;

at the end of your code. This will display your mistakes you don't have query user_errors. When you close a cursor set you just use the name of cursor with no parameters, or the parameter list appears in the reference cursor in the Type statement on line 13.

The rest is up to you.

HTH - Mark D Powell.

Tags: Database

Similar Questions

  • Pavilion 15-p108ne: my computer laptop p108ne I hope that I can install Windows 7 Windows 7 drivers. But what was not in the site

    My computer laptop p108ne I hope that I can install Windows 7 Windows 7 drivers. But what was not in the site

    Hello:

    You should be able to use the W7 x 64 drivers and software of p000-15 t on your model, except the BIOS and firmware files.

    http://support.HP.com/us-en/drivers/selfservice/HP-Pavilion-15-P000-notebook-PC-series/6936226/model/7174371

  • Open the pl/sql block pop title request page

    Hi all

    Can someone show me the correct syntax for opening a page of the application in a window popup using
    of htp.p of pl/sql with (parameters of the page.) or local variables of the pl/sql block?

    And also how can force you a refresh of the page parent once the pop-up was closed.

    Any help would be appreciated.

    Kind regards
    Cleo

    Hello

    To generate a link to a pop-up window on your parent page:

    htp.p(' <a href="javascript:callPopup('||:P1_ID|| ')" > ');
    

    And add this in the header html on your parent page:

    <script type="text/javascript" >
    
    function callPopup(recordId){
     var url;
      url = 'f?p=&APP_ID.:POPUPPAGEALIAS:&APP_SESSION.::::P_RECORD_ID:' + recordId;
      w = open(url,"textarea","Scrollbars=1,resizable=1,width=800,height=600");
      if (w.opener == null)
      w.opener = self;
      w.focus();
    }
    
    </script >
    

    And to refresh the page parent after the closure of the pop-up window, add to the html on your popup page header:

    <BODY onUnload="javascript: window.opener.location.reload(true);">
    
  • My first while loop inside the PL/SQL block does not, please help

    Hello

    I'm new to PL/sql and struck PL SQL blocks, please help solve this problem.

    declare

    constant v_A number: = 10;
    constant number j: = 3;

    BEGIN

    WHILE j < v_A
    LOOP
    DBMS_OUTPUT. Put_line ('Hai');
    END LOOP;
    END;

    Please help as how to solve this problem.

    Thanks in advance.

    You cannot declare j as in 'permanent' If you want to increment its value. better go to another variable if you intentionally want constant j.

    Something like this:

    declare
    v_A number constant:=10 ;
    j number constant := 3 ;
    i number;
    BEGIN
    i := j;
    WHILE i < v_A
    LOOP
    i := i + 1;
    DBMS_OUTPUT.PUT_LINE('Hai');
    END LOOP;
    END;
    

    ... Vivek

    Published by: Vivek 21 Sep, 2010 02:54

  • "Control terminals on component connector not on the level superior. block diagram" to comment on the report of the ADC

    Hi all

    Could someone enlighten me please, what does this comment on the value of the ADC

    "Terminals on component connector not on the block diagram of higher level of control.

    This means that some terminals is hidden within certain structures of the case and does not show not not the diagram without going into the structures of the case or by 'higher level block diagram', it means

    main.VI and main.vi controls must also be connected to the connector pane?

    Thank you

    K.Waris

    On the one hand, this means that they run on your screws VI Analyzer, since it is a warning in extenso you receive.  This means simply a terminal which is connected to the ConPane is not on the top level diagram, IE. within a structure of housing.

    As to why he is often not a good idea to do that read this classic thread:

    http://forums.NI.com/T5/LabVIEW/case-structure-parameter-efficiency/m-p/382516#M191622

  • DHCP server does not start - the storage control block address is invalid.

    I use a trial version of the Pro Workstation 12.1.1 on Windows 10. I seem to have a strange problem where the DHCP service does not start.

    I tried to go into the virtual network editor and then restore the default settings, which had no effect.

    The event viewer displays the following text:

    CreateFile Version ioctl(): VMnet8 (327680 393216): the operation completed successfully.

    / The storage control block address is invalid

    Checked the service and it runs under a local, verified system account permissions on the config dhcp / rental file in c:\programdata\vmware\ and both have system configured to full control. I tried to run the vmnetdhcp.exe in a command prompt to we hope to get additional information, but cannot be executed directly. I can't figure out how to get out of documented logging dhcp server in order to track down what could be the culprit.

    I tried to uninstall workstation, restart, reinstall, restart both unsuccessfully. I had version 9 workstation that was installed previously, in which the trial upgrade.

    Any suggestion would be appreciated.

    Figured it out.

    It appears during the workstation installation 9, he placed vmnetdhcp and vmnetnat in c:\windows\syswow64 folder. Pro 12 workstation puts these files in the default directory (C:\Program Files (x 86) \VMware\VMware workstation). The service was always pointing to the old location even SysWow64 after an uninstall and reinstall.

    I replaced the files SysWow64 folder workstation and services started right up.

    Checked the work by selecting NAT and gets an IP address from the host machine.

  • Select the query within the PL/SQL block.

    Hello Experts,

    I'm just a beginner with PL/SQL.
    If I write a select query of client like fire against a database and SQL dev, it gives me result.
    For example: select * from employee;

    Now suppose that when I use the same query within a PL/SQL block:
    Declare
    Start
    Select * from employee;
    end;
    /
    It gives error during execution, by mentioning that an INTO should etc...
    I have my doubts here:
    1. is it impossible to use a simple select statement within a PL/SQL block (If yes why?)

    I know it's a very basic question, I tried to search it on the forum but could not find the thread, please redirect me to the link if it is already the answer.

    Please read this first. may ask why?

    http://docs.Oracle.com/CD/B28359_01/AppDev.111/b28370/TOC.htm

  • Please draw what's not in the TRIGGER script, does not trigger.

    Hi gurus of the Oracle,.

    Please help me to find out what's wrong in the trigger statement. It does not create trigger, instead, it displays line numbers like 1, 2, 3, 4... After pressing the Enter key,

    I enclose the full script, where it modifies the table, then creates the new table, the sequence of creates... Finally, it fails to create the trigger.
    ==================================================================================

    SQL > ALTER TABLE MOBILE. ADD MOBILE_USER (LAST_LOGIN TIMESTAMP);

    Modified table.

    SQL > CREATE TABLE "MOBILE". "" AUDIT_LOG.
    (
    2 3 NUMBER (16.0) 'AUDIT_LOG_ID' NOT NULL ACTIVATE.
    4 'DATE_CREATED' TIMESTAMP (6) NOT NULL ACTIVATE.
    VARCHAR2 (20 BYTE) 'AUDIT_TYPE' 5 NOT NULL ACTIVATE.
    CLOB 6 "AUDIT_DATA."
    7 CONSTRAINT "AUDIT_LOG_PK" KEY PRIMARY ("AUDIT_LOG_ID") WITH THE HELP OF INDEX PCTFREE, INITRANS 10 2 ALLOW MAXTRANS 255 STORAGE (INITIAL 65536 THEN 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 USER_TABLES DEFAULT TABLESPACE) "SERVICES_DATA".
    6 g
    9 10 PCTUSED 40 INITRANS PCTFREE MAXTRANS 255 NOCOMPRESS LOGGING STORAGE 1
    (
    INITIALS 65536 THEN 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 DEFAULT USER_TABLES
    (10-11-12)
    TABLESPACE LOB OF 'SERVICES_DATA '.
    (13-14)
    15 "AUDIT_DATA".
    16)
    17 STORE AS
    18)
    STORAGE OF 'SERVICES_DATA' CHUNK ONLINE STORAGE 8192 PCTVERSION 10 NOCACHE RECORD TABLESPACE 19 (INITIAL 65536 THEN 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 DEFAULT USER_TABLES)
    (20);

    Table created.

    SQL > CREATE the SEQUENCE "MOBILE". "' AUDIT_LOG_SEQ ' INCREMENT BY 1 START WITH 1000 CACHE 20 NOCYCLE.

    Order of creation.

    SQL > create or replace
    TRIGGER "MOBILE". "' AUDIT_LOG_TRGR ' front
    INSERT in 'AUDIT_LOG' for EACH row BEGIN if insertion THEN if: NEW. "' AUDIT_LOG_ID ' IS NULL THEN
    SELECT AUDIT_LOG_SEQ.nextval
    IN: NEW. "" AUDIT_LOG_ID ".
    DOUBLE;
    END IF;
    END IF;
    END;

    We already checked that AUDIT_LOG exists.

    AUDIT_LOG exists for schema MOBILE, but NOT for the scheme which tries to create the trigger.

    INSERT in 'AUDIT_LOG' for EACH row BEGIN if insertion THEN if: NEW. "' AUDIT_LOG_ID ' IS NULL THEN

    not like above, but as below
    INSERT ON MOBILE. AUDIT_LOG FOR EACH row BEGIN if insertion THEN if: NEW. "' AUDIT_LOG_ID ' IS NULL THEN

  • to change the pl/sql block to get the value of the user

    In this code rather than affect the value of the SID in the block, I want to get the sid of the user.

    Help, please.

    Oracle Database 10 g Express Edition Release 10.2.0.1.0 - product
    PL/SQL Release 10.2.0.1.0 - Production
    CORE 10.2.0.1.0 Production
    AMT for 32-bit Windows: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production

    declare

    v_sname t1.sname%type;

    v_issue_date t3.issue_date%type;

    v_book_title t2.book_title%type;

    v_book_id t2.book_id%type;

    cursor c1 is

    Select t1.sname, t3.issue_date, t2.book_title, book_id

    join T1 T3

    using (SID)

    Join t2

    using (book_id)

    where sid = 1;

    Start

    Open c1

    loop

    dbms_output.put_line (v_sname |) » '  || v_issue_date | » '  || v_book_title | ' ' || v_book_id);

    extract the c1 in v_sname, v_issue_date, v_book_title, v_book_id;

    When exit c1% notfound;

    end loop;

    Close c1;

    end;

    /

    Thank you

    If I set up a script that I want to pass a value, I just a configuration variable and name it and use it very similar to a procedure or function. Makes it easy to implement a procedure/function, or to convert a function/procedure in a PL/SQL block for test/debugging with relatively few changes to the code inside:

    declare
       in_sid  number  := to_number('&1');
    
       v_sname t1.sname%type;
       v_issue_date t3.issue_date%type;
       v_book_title t2.book_title%type;
       v_book_id t2.book_id%type;
       cursor c1 is
          select t1.sname, t3.issue_date, t2.book_title, book_id
          from t1 join t3
          using(sid)
          join t2
          using(book_id)
          where sid=in_sid;
    begin
       open c1
       loop
          dbms_output.put_line( v_sname ||' '  || v_issue_date ||' '  || v_book_title || ' ' || v_book_id);
          fetch c1 into v_sname, v_issue_date, v_book_title, v_book_id;
          exit when c1%notfound;
       end loop;
       close c1;
    end;
    /
    
  • Ignore the error and continue the pl/sql block

    Dear all,

    Please help me to fix the script below.

    I had an obligation to write a pl/sql that will handle the update instructions.

    For example:
    A table that contains 10 rows of data. Through pl/SQL block, I update the 10 rows (or a smaller number of lines).
    Now, the scenario is by updating registration / line 4, oracle has met an error and then oracle leave pl/sql block and cancel the transaction.

    My requirement here is, by updating the records, if oracle encounters an error, it must raise an error or ignore the record and continue to process records. Oracle wouldn't pl/sql block.

    We are using oracle 10g.

    Thank you
    KODS

    As has already been suggested, you might check DML ERROR LOGGING

  • How to execute the pl/sql block from a file

    Hi all
    can someone tell me how to execute a pl/sql block to a file.it does contain no procedures.it is of the form
    -Start
    -says
    -end;

    Thanx

    Ok.. If the time points? :)

    See you soon!
    Bobin

  • DIRT and what his role with the MS - SQL database

    I am setting up the procedure for the Bare Metal Restore for our Telco servers. And I wonder if the DIRT back up the MS - SQL databases.

    We have 4.0 (4) SR1 and use DIRT 1.0 Build 122

    Thank you

    Debbie

    Restoration of dirt requires that the unit (same saved version) is running before, it'll do a restore - as these UnityDB and ReportDb databases must be present - restoring pulling data out of the local DBs first before their replacement by the saved tables (without things like the name of the local server, which GC/DCs we are connected) configuration etc...). So no, it won't it create on the fly because the restore cannot function without a server in operation of the first unit. This isn't just a backup and restore, but also a type migration tool.

  • What about notes at the end of EACH chapter?

    OK, I know that Indesign is not configured for the end notes (Yes, I say it is staggering - please, please fix this). I made of the workarounds for formatting of notes before and will do so again if necessary. BUT, now, I have a customer who wants their notes at the end of each chapter (each set up as another story).

    Before doing the work of the workaround again, is it possible that ID will import chapters special, with notes and put in place pointed out that the notes at the end of each chapter (not the book)?

    I just want to know before doing the layout with the notes of liaison through paragraph styles (yuck!).

    In parentheses, you are all working on a fix for this? My friend guard shout to learn me LaTeX for this reason alone (not to mention costs).

    Thank you

    krmartel wrote:

    And they will remain as the end of chapter notes, when I build the book?

    Uh, why of course they do. As soon as InDesign important chapter, all notes are converted to plain text. And while they "won't budge" anywhere, just like regular text.

    The only way that can happen that you ask here is if does InDesign support 'live' in the end notes. Which, as you know, this isn't.

  • What's not in the scheme of my authorization?

    Hi all

    I use 5 APEX

    And I Beginner in apex5

    My problem is:

    I created authorization of navigation menu / entries list of ..


    Details:

    My type of authorization: PL/SQL function returning a Boolean evaluation Point: once a part

    My function is:

    create or replace function fun_auth_menu
    return boolean 
    is 
    Begin@@
    
    
      if v('APP_COMPONENT_NAME') = 'test'   -- 'test' it's the name of list entry 
      then return true;
      else return false;
    
      end if; 
    
    End;
    
    

    But not work when selecting this scheme authorization for the entry in the list.

    What is wrong...?

    Please help me...

    Jitendra

    Hello

    You must use: APP_COMPONENT_NAME instead of v ('app_component_name'). The authorization scheme only supports bind variables syntax. As you place the code in a standalone function, you must pass the value as a formal parameter.

    Kind regards

    Christian

  • Value of the item not appearing is not in the PL/SQL function on another element.

    Basically, I'm trying to update a field in database based on the vaule of 2 other fields, but the value of the dow are not stored. No error, it just presents itself as a null value in the database. Here is the code inside the default zone in FL/SQL function.

    declare
    P14_TNUM VARCHAR2 (255);
    Start
    Select P14_TNUM from T1, T2 where mi = concat (mname, id): P14_TID;
    Return P14_TNUM;
    exception when others then
    Returns a null value.
    end;


    Note:
    ID is in T1
    MNAME and mid is T2

    : P14_TID is the element that points to the pk of the T1 table

    Anon,

    I'm still a little confused as to what you're trying to do. Could you please take a bit to explain better?

    Kind regards
    Dan

    http://danielmcghan.us
    http://sourceforge.NET/projects/tapigen
    http://sourceforge.NET/projects/plrecur

Maybe you are looking for

  • How to add a page with a star "hollow"?

    I have no problem save bookmarks with a White Star completely filled in, but many web pages show a star that is not full (it appears 'hollow') that I can't save. When I select the "hollow" star to try to save him, a blue star hop on to the image in t

  • How can I activate the audio to my TV

    There are has 2 choices for default audio - my laptop and tuner, nothing on my TV. I accidentally deleted the choice of headphones, but I still need, if I use headphones? I want just the sound through my HDMI cable. He used to work, but I changed som

  • Name of file icons overlapping labels

    On one of my external hard drives, file name in some cases labels are overlapping the icons folder, and in others, they are far enough away from the icon. When I backed up on a new disc, the problem was transferred. Is their something in the trash to

  • Compatibility issues with the latest Version of DAQmx

    This one has left me speechless, so I thought I'd go the bulletin boards. I am under some equipment that returns a voltage across a NI USB-6361. The company that hired me was using an older version of LabView (I can't tell you what, 2012 I think). In

  • Slow start of the missing files?

    I recently deleted some .tmp files and since Windows XP (SP3) is very slow to start. I did a clean boot and it takes so much time. The delay occurs after the Welcome screen disappears from the screen and lasts a little more than a minute. After the s