Close popup at the end of the procedure

I built a custom shortcut menu that I use to store a value in conjunction with the current screen. The popup contains the values of the current screen, asking the user for a little more entries, and then saves the records. The procedure works very well. Once the procedure is completed, I want to close the pop-up window.

I tried two things: using a procedure to close the Popup window and use of indicators of this thread:
Re: Close the popup after MRU

I got to work (part close) but I had to go back and change some of my page and now it does not work yet. Can anyone suggest what to watch?

Header HTML:
<script language="JavaScript" type="text/javascript">
function closeWindow() 
{
 if ( document.getElementById("P1069_SAVESTATUS").value == 'R' )
 {
  window.opener.location.href=window.opener.location.href;
  window.close();
 }
}
</script>
One of the regions HTML, source is:
<script language="JavaScript" type="text/javascript">
  onLoad="closeWindow();"
</script>
Article P1069_SAVESTATUS of the region is defined as hidden, the value "n" when session state is null.

Process is the following (triggered by the button FINISH):
declare
  v_job        NUMBER     := :P1069_TC_ID;
  v_dt         DATE       := to_date(:P1069_DT,'MM/DD/YYYY');
  v_emp        NUMBER     := :P1069_EMP_ID;
  v_pkg        NUMBER     := :P1069_PKG_ID;
  cursor c_pkg is select COURSE_ID from TRAINING_PKG_ASSIGN
            where COURSE_PKG_ID = v_pkg and COURSE_ID > 0
            order by COURSE_ORDER;
  v_crs        NUMBER;
  v_eemp       NUMBER     := :G_USER_ID;
  v_edt        DATE       := SYSDATE;
begin
  delete from EMP_TRN_HISTORY
   where TC_ID = v_job;
  open c_pkg;
    LOOP
      FETCH c_pkg into v_crs;
      EXIT WHEN c_pkg%NOTFOUND;
        insert into EMP_TRN_HISTORY (EVENT_ID, EVENT_DATE, TRN_CRS_ID,
              ENTRY_EMP_ID, ENTRY_DATE, TC_ID, EMP_ID, PKG_ID)      
           values (SEQ_EMP_HISTORY.nextval, v_dt, v_crs,
                 v_eemp, v_edt, v_job, v_emp, v_pkg);
    END LOOP;
  close c_pkg;
  :P1069_SAVESTATUS  := 'R';
end;

Try to change the HTML code in your area for


onload = "" notation would be used if you were putting the function call the "tag of the page.

Tags: Database

Similar Questions

  • Error (34.2): PLS-00103: encountered the symbol "END" when you try to compile the procedure.

    Hello

    I get the following error when I try to compile the procedure. I call a package inside this simple procedure. Not sure where I do worng. Here is the error I get.

    Error (34.2): PLS-00103: encountered the symbol "END"?

    Here is my code

    create or replace PROCEDURE BATCH_JOB_CAC_SP

    (

    vstatus OUT NUMBER)

    AS

    vloadserver global_name.global_name%TYPE: = get_dbservername;

    vuseridmod CONSTANT VARCHAR2 (15): = 'SYSTEM '.

    vloadname CONSTANT VARCHAR2 (30): = "BATCH_JOB_CAC_SP";

    v_cnt_upd NUMBER: = 0;

    vrunid NUMBER;

    v_spoutput VARCHAR2 (150);

    CURSOR job_cac

    IS

    SELECT NumCli, job_cac FROM batch_job_cac, batch_recid, jobnum;

    BEGIN

    I'm in job_cac LOOP

    job_cac_pkg.job_cac_valid_sp (i.custnum, i.jobnum, v_spoutput);

    CASE v_spoutput

    WHEN "1" THEN DBMS_OUTPUT. Put_line ('update job ACC');

    WHEN "2" THEN DBMS_OUTPUT. Put_line ('update job ACC');

    WHEN '3' THEN DBMS_OUTPUT. Put_line ('can not update working ACC');

    OF ANOTHER DBMS_OUTPUT. Put_line (v_spoutput);

    END CASE;

    END LOOP;

    EXCEPTION

    WHILE OTHERS THEN

    IF job_cac % isopen THEN

    CLOSE Job_cac;

    END IF;

    ROLLBACK;

    vStatus: = 1;

    LOG_ERROR_SP_NM (vLoadServer, vLoadName, SQLCODE, SQLERRM, vUserIdMod);

    END;

    END BATCH_JOB_CAC_SP;

    Thanks for your help.

    Hello

    You have 2 statements END at the bottom of your code, but only 1 BEGIN statement earlier.

    Losing one of these END States.

  • The game I play is Combat arms, I gave it through the firewall but I still have to allow him, and in the end, the combat arms stops responding and closes due to the DEP. I have it enabled on DEP. Please help me.

    The game I play is Combat arms, I gave it through the firewall but I still have to allow him, and in the end, the combat arms stops responding and closes due to the DEP (Data Execution Prevention). I leave on the DEP list. Please help me.

    Hi Brainiac107,

    1 when was the last time it was working fine?

    2. did you of recent changes on the computer?

    Method 1

    Check and make sure that you have followed the method to allow the game through the protection of execution of data (DEP) below.

    "" "" "a) departure ' Run ' sysdm.cpl ' click 'Advance' tab" now click on 'Settings' running ' then click on the "Data Execution Prevention" tab

    (b) now click on the "turn on DEP for all programs and Services except those I select:

    (c) then click add and go to and select C:\Nexon\Combat Arms\engine.exe

    (d) now, click Ok then apply.

    (e) restart the computer.

    Change Data Execution Prevention settings

    http://Windows.Microsoft.com/en-us/Windows-Vista/change-data-execution-prevention-settings

    Change Data Execution Prevention settings

    http://Windows.Microsoft.com/en-us/Windows7/change-data-execution-prevention-settings

    Method 2

    If the previous step fails, then try to run the game with administrator privileges and check if it works.

    (a) right to the shortcut from the game or if you try to install the game, right click on the game setup.

    (b) click on run as administrator.

    Method 3

    If you're still having problems with the game then post your request in the forums of game seller.

    http://Forum.NEXON.NET/CombatArms/forums/8624/ShowForum.aspx?PageIndex=2&SB=0&d=1&DF=11

    I hope this helps!

    Halima S - Microsoft technical support.

    Visit our Microsoft answers feedback Forum and let us know what you think.

  • How can I display an error message on the listening port close popup without closing the popup.

    Hi Experts,

    JDeveloper 12.1.3.0.0

    How can I display an error message on the listening port close popup without closing the popup.

    Thank you

    Roy

    As its name suggests, close listener of popup is called when popup is closed so you can not do this.

    If you want to display the popup message, use your own buttons instead of the ok/cancel default buttons and close the popup programmatically.

    Dario

  • Hi, I am not able to execute the procedure using dblink in PLSql block. Although he works outside the end of the beginning. Please suggest solution

    Hello

    I'm not able to execute the procedure using dblink in PLSql block.

    Although he works outside the end of the beginning.

    Please suggest solution

    Hello

    Thanks everone for your contributions,

    As well as the permissions, I used to run inside the PL sql block, which was not necessary, we can simply call the procedure using dblink.

    Thanks guys,.

  • How to restore the button 'Close tab' at the END of the tab bar?

    Until FF31, I used the following configured setting that installs the small 'X' button which tabs off the tabs themselves and on the far right of the bar closed tabs.

    browser.tabs.closeButtons; The user's game; Integer; 3

    No, this no longer works. It is always placed close buttons in the buttons on the tab. Until I can understand how to solve this problem, I'll be move back to a previous version. I can't for the life of see me why this feature has been removed, other than the apparently arrogant insistence of Mozilla that he knows what the people want better than them.

    You can watch these extensions.

    You can check the settings of the extension of the CTR through the Options/preferences button on the page "Firefox/tools > Modules > Extensions.

  • Data recovery before the insert in the procedure

    Hello
    I'm new in plsql programming and I'd like to do a procedure. I have tables like the following table1:

    | COL1 | COL2. COL3 | COL4 | COL5 | COL6 | COL7 |
    | 600. 140. 2. 10. 1300 | 500 | 1.
    | 600. 140. 2. 20. 1400 | 340. 4.
    | 600. 140. 2. 15. 1400 | 230. 3.
    | 600. 140. 2. 35. 1700 | 120. 2.
    | 600. 150. 3. 10. 1300 | 166. 6.
    | 600. 150. 3. 15. 1400 | 435. 5.

    For the same COL1 and COL2/COL3, check out the selection of different values of COL4
    For example, for COL1 = 600, COL2 = COL3/140 = 2 and COL2 = COL3/150 = 3
    Return not common 20 and 35 as values


    Then insert the rows in this table TABLE1
    600, 150, 3, 20, 1400, 340, 7
    600, 150, 3, 35, 1700, 120, 8


    I'm doing the procedure as below but I have problem how to recover data in the insert statement

    PROCEDURE COPY_COLUMNS  ( P_COL1        IN  A.COL1%TYPE,
                              P_FROM_COL2   IN  B.COL2%TYPE,
                              P_FROM_COL3   IN  B.COL3%TYPE,
                              P_TO_COL2     IN  B.COL2%TYPE,
                              P_TO_COL3     IN  B.COL3%TYPE,
                              P_FLG1        IN  VARCHAR2,
                              P_FLG2        IN  VARCHAR2,
                              P_FLG3        IN  VARCHAR2                                      
                                         ) IS
    
    CURSOR CFL1 IS select COL4
        FROM TABLE1
        WHERE COL1 = P_COL1 AND COL2 = P_FROM_COL2 AND COL3 = P_FROM_COL3
        MINUS
        select COL4
        FROM TABLE1
        WHERE COL1 = P_COL1 AND COL2 = P_TO_COL2 AND COL3 = P_TO_COL3;
    
    
    CURSOR CFL2 IS select COL4
        FROM TABLE2
        WHERE COL1 = P_COL1 AND COL2 = P_FROM_COL2 AND COL3 = P_FROM_COL3
        MINUS
        select COL4
        FROM TABLE2
        WHERE COL1 = P_COL1 AND COL2 = P_TO_COL2 AND COL3 = P_TO_COL3;
    
    
    CURSOR CFL3 IS select COL4
        FROM TABLE3
        WHERE COL1 = P_COL1 AND COL2 = P_FROM_COL2 AND COL3 = P_FROM_COL3
        MINUS
        select COL4
        FROM TABLE3
        WHERE COL1 = P_COL1 AND COL2 = P_TO_COL2 AND COL3 = P_TO_COL3;  
    
    
    V_REC        CFL1%ROWTYPE;
    
    
    BEGIN
    
    
    IF P_FLG1='N' OR P_FLG2='N' OR P_FLG3='N' THEN
        GOTO label; --do nothing
    END IF;
    
    
    IF P_FLG1 = 'Y' THEN
    
        OPEN CFL1;
        FETCH CFL1 INTO V_REC;
        CLOSE C1;
    
    --    SELECT COL5, COL6
    --    FROM TABLE1
    --    WHERE COL1 = P_COL1 AND COL2 = P_FROM_COL2 AND COL3 = P_FROM_COL3 AND COL4 = V_REC.COL4;
    
    
        FOR REC IN CFL1 LOOP
            INSERT INTO TABLE1 
                SELECT P_COL1, P_TO_COL2, P_TO_COL3, CFL1.COL4, -- COL5 ?? , COL6 ?? -- , SEQname2.NEXTVAL) 
    
    
        END LOOP;
    
    END IF;
    
    <<label>>
    END;
    

    Could you help me please do so?
    Thanks in advance

    And if you want to insert the missing values COL4 both sense, use of full join, as I've already shown (slightly modified):

    SQL > insert
    2 in table1
    3 values (600,150,3,70,1500,567,8)
    4.

    1 line of creation.

    SQL > insert
    2 in table1
    3 values (600,150,3,90,1900,789,9)
    4.

    1 line of creation.

    SQL > select *.
    2 from table1
    3.

    COL1 COL2 COL3 COL4 COL5 COL6 COL7
    ---------- ---------- ---------- ---------- ---------- ---------- ----------
    600 140 2 10 1300 500 1
    600 140 2 20 1400 340 4
    600 140 2 15 1400 230 3
    600 140 2 35 1700 120 2
    600 150 3 10 1300 166 6
    600 150 3 15 1400 435 5
    600 150 3 70 1500 567 8
    600 150 3 90 1900 789 9

    8 selected lines.

    SQL > insert
    2 in table1
    3 with t1 as)
    4 Select
    5 from table1
    6 where col1 =: P_COL1
    7 and col2 =: P_FROM_COL2
    8 and col3 =: P_FROM_COL3
    9 and: P_FLG1 = 'Y '.
    10              ),
    11 t2 as)
    12. Select *.
    13 from table1
    14 where col1 =: P_COL1
    15 and col2 =: P_TO_COL2
    16 and col3 =: P_TO_COL3
    17 and: P_FLG1 = 'Y '.
    18              )
    19 select: P_COL1 col1,.
    nvl2(t1.col4,:P_TO_COL2,:P_FROM_COL2) 20 col2,
    nvl2(t1.col4,:P_TO_COL3,:P_FROM_COL3) 21 col3,
    22 nvl (t1.col4, t2.col4) col4,
    NULL, 23
    NULL, 24
    25 null
    26 of t1
    join full 27
    28                t2
    29 on t2.col4 = t1.col4
    30 where the t1.col4 is null
    31 or t2.col4 is null
    32.

    4 lines were created.

    SQL > select *.
    2 from table1
    3.

    COL1 COL2 COL3 COL4 COL5 COL6 COL7
    ---------- ---------- ---------- ---------- ---------- ---------- ----------
    600 140 2 10 1300 500 1
    600 140 2 20 1400 340 4
    600 140 2 15 1400 230 3
    600 140 2 35 1700 120 2
    600 150 3 10 1300 166 6
    600 150 3 15 1400 435 5
    600 150 3 70 1500 567 8
    600 150 3 90 1900 789 9
    600 140 2 70
    600 140 2 90
    600 150 3 35

    COL1 COL2 COL3 COL4 COL5 COL6 COL7
    ---------- ---------- ---------- ---------- ---------- ---------- ----------
    600 150 3 20

    12 selected lines.

    SQL >

    SY.

  • ForAll in the procedure

    Hi all

    I am a beginner in PL/SQL... Need your expertise in this...

    CREATE TABLE CUST

    (

    S_DATA VARCHAR2 (40 BYTES) BY DEFAULT ' ' NOT NULL,

    V_YEAR VARCHAR2 (8 BYTES) BY DEFAULT ' ' NOT NULL,

    S_STAT VARCHAR2 (1 BYTE),

    DATE OF START_DT,

    END_DT DATE,

    S_DESP VARCHAR2 (60 BYTE),

    SRCE_YEAR VARCHAR2 (4 BYTE),

    S_SEQ NUMBER 4,

    S_SOURCE VARCHAR2 (30 BYTE),

    );


    CREATE A UNIQUE CUST_PK ON CUST (S_DATA, V_YEAR) INDEX;

    ALTER TABLE CUST ADD()
    CONSTRAINT CUST_PK
    KEY ELEMENTARY SCHOOL
    (S_DATA, V_YEAR)
    ENABLE VALIDATE);


    Few records of the table...

    Insert into cust values (' 2014 'LITEM', ',', TO_DATE (1 January 2014 ',' DD/MM/YYYY '), TO_DATE (December 31, 2014 ',' DD/MM/YYYY '), 'BookLEM', ' 2014 ", 89, 'Mary');
    Insert into cust values (' 2011 'NJM', ',', TO_DATE (January 1, 2014 ',' DD/MM/YYYY '), TO_DATE (December 31, 2014 ',' DD/MM/YYYY '), 'BookLEM', ' 2014 ", 89, 'Mary');
    Insert into cust values ('LM', '2014', ', TO_DATE (1 January 2014 ',' DD/MM/YYYY '), TO_DATE (December 31, 2014 ',' DD/MM/YYYY '), 'test rec', '2014', 1, 'Jacob');
    Insert into cust values (' 2014 'KHJ', ',', TO_DATE (January 1, 2014 ',' DD/MM/YYYY '), TO_DATE (December 31, 2014 ',' DD/MM/YYYY '), 'store rec', '2014', 4, 'Jacob');
    Insert into cust values ('KIFM', ' 2000 ',', TO_DATE (1 January 2014 ',' DD/MM/YYYY '), TO_DATE (December 31, 2014 ',' DD/MM/YYYY '), 'BookLEM', ' 2014 ", 89, 'Mary');


    Table cust has around 48000 records. I create a stored procedure to insert records for each record in the cust with v_year = 2014, with the range below...

    1. for each record from 2014 to cust = v_year, create records with v_year = 2015 (with s_stat = 'B') and v_year = 2016,2017,2018 (with s = s_stat ')
    2 start_dt, end_dt will vary respective to the v_year as below in insert statements.
    3. prior to insert the records, check if the file already exists, if there are jump the insert for this year.   -I don't know how this script as well...


    create or replace procedure cust_test (
    out_ret_code OUT NUMBER,
    out_err_msg  OUT VARCHAR2) 
    is
    
            CURSOR samp_cur is
                 select * from cust where v_year='2014';
    TYPE cur_data is TABLE OF cust%ROWTYPE;
    result_data   cur_data := cur_data();
    begin
      open samp_cur;
      loop
           fetch samp_cur BULK COLLECT into result_data limit 1000000;
           exit when result_data.COUNT=0;
           FORALL idx in 1..result_data.COUNT 
                  insert into cust (s_data,v_year,s_stat,start_dt,end_dt,s_desp,srce_year,s_seq,s_source)
                  values (result_data(idx).s_data,'2015','B',to_date('01/01/2015', 'MM/DD/YYYY'),to_date('12/31/2015','MM/DD/YYYY'),result_data(idx).s_desp,'2015',result_data(idx).s_seq,'user1');
         
                  insert into cust (s_data,v_year,s_stat,start_dt,end_dt,s_desp,srce_year,s_seq,s_source)
                  values (result_data(idx).s_data,'2016','S',to_date('01/01/2016', 'MM/DD/YYYY'),to_date('12/31/2016','MM/DD/YYYY'),result_data(idx).s_desp,'2016',result_data(idx).s_seq,'user1');
                  insert into cust (s_data,v_year,s_stat,start_dt,end_dt,s_desp,srce_year,s_seq,s_source)
                  values (result_data(idx).s_data,'2017','S',to_date('01/01/2017', 'MM/DD/YYYY'),to_date('12/31/2017','MM/DD/YYYY'),result_data(idx).s_desp,'2017',result_data(idx).s_seq,'user1');
                  insert into cust (s_data,v_year,s_stat,start_dt,end_dt,s_desp,srce_year,s_seq,s_source)
                  values (result_data(idx).s_data,'2018','S',to_date('01/01/2018', 'MM/DD/YYYY'),to_date('12/31/2018','MM/DD/YYYY'),result_data(idx).s_desp,'2018',result_data(idx).s_seq,'user1');
       END LOOP;
     Close samp_cur;
    end;
    /
    

    I get an error in the procedure that must be declared IDX... Also, please advise if it is correct in terms of scope... Appreciate your help...

    Thank you very much.


    INSERT INTO CUST

    (

    S_DATA

    V_YEAR

    S_STAT

    START_DT

    END_DT

    S_DESP

    SRCE_YEAR

    S_SEQ

    S_SOURCE

    )

    SELECT S_DATA, the_year, CASE WHEN the_year = 2015 CAN ' to ' B' ELSE ' END

    TO_DATE(the_year||) e 0101', 'YYYYMMDD'), TO_DATE(the_year||) e 1231', 'YYYYMMDD')

    s_desp

    the_year

    s_seq

    , "user1".

    FROM CUST, (SELECT 2014 + LEVEL the_year FROM DUAL CONNECT BY LEVEL<>

    WHERE V_YEAR = ' 2014 "

    ;

    You can use merge or condition NOT EXISTS to skip existing records, like this:

    MERGE INTO CUST
    WITH THE HELP OF)
    SELECT S_DATA, the_year V_YEAR, WHEN the_year-CASE = 2015 THEN ' of ' B' ELSE ' END S_STAT
    TO_DATE(the_year||) e 0101', 'YYYYMMDD') START_DT, TO_DATE(the_year||) e 1231', 'YYYYMMDD') END_DT
    s_desp
    the_year SRCE_YEAR
    s_seq
    "user1" S_SOURCE
    FROM CUST, (SELECT 2014 + LEVEL the_year FROM DUAL CONNECT BY LEVEL<>
    WHERE V_YEAR = ' 2014 "
    ) D
    ON (CUST. S_DATA = D.S_DATA AND CUST. V_YEAR = D.V_YEAR)
    WHEN NOT MATCHED THEN INSERT
    (
    S_DATA
    V_YEAR
    S_STAT
    START_DT
    END_DT
    S_DESP
    SRCE_YEAR
    S_SEQ
    S_SOURCE
    )
    VALUES)
    D.S_DATA
    D.V_YEAR
    D.S_STAT
    D.START_DT
    D.END_DT
    D.S_DESP
    D.SRCE_YEAR
    D.S_SEQ
    D.S_SOURCE
    );

    or:

    INSERT INTO CUST
    (
    S_DATA
    V_YEAR
    S_STAT
    START_DT
    END_DT
    S_DESP
    SRCE_YEAR
    S_SEQ
    S_SOURCE
    )
    SELECT S_DATA, the_year V_YEAR, WHEN the_year-CASE = 2015 THEN ' of ' B' ELSE ' END S_STAT
    TO_DATE(the_year||) e 0101', 'YYYYMMDD') START_DT, TO_DATE(the_year||) e 1231', 'YYYYMMDD') END_DT
    s_desp
    the_year SRCE_YEAR
    s_seq
    "user1" S_SOURCE
    CUST C1, (SELECT 2014 + LEVEL the_year FROM DUAL CONNECT BY LEVEL<>
    WHERE V_YEAR = '2014' AND NOT EXISTS (SELECT 1 FROM CUST WHERE S_DATA = C1. S_DATA AND V_YEAR = the_year);

  • How to pass the value of the cursor in the procedure to use as dblink

    Hello

    I have a cursor in the procedure. I am inserting some values into the destination table by querying the source table using dblink. And I'm collecting this db link in the cursor. So, my question is how I will pass on the value of dblink values read from the cursor in each iteration? This is my procedure.

    CREATE OR REPLACE
        PROCEDURE desktop_proc
        AS
          v_name VARCHAR2(10);
          v_dblink  VARCHAR2(10);
          CURSOR db_cur
          IS
            SELECT PNAME,OLTP_DBLINK
            FROM PDATA
            WHERE pname in ('RMA','RNA')
            ORDER BY PNAME;
        BEGIN
          OPEN db_cur;
          LOOP
            FETCH db_cur INTO v_name,v_dblink;
            EXIT WHEN db_cur%NOTFOUND;
            INSERT INTO desktop_lite
              (
                Datestamp,
                pname,
                Db_name,
                Company_name
              )
            SELECT Date_Range,
              v_name,   -- local variable
              dbname,
              Company_name
              FROM
              (SELECT bu.datestamp Date_Range,
                      (SELECT name FROM v$database@v_dblink) dbname,
                      bu.name Company_name
               FROM dboltp.s_org_ext@v_dblink bu
               INNER JOIN com_unique uusers ON (uusers.bu_id = bu.row_id)
              );
          END LOOP;
          CLOSE db_cur;
        END desktop_proc;
    

    Thank you

    Maybe this can work for you:

    CREATE OR REPLACE
        PROCEDURE desktop_proc
        AS
          v_name    VARCHAR2(10);
          v_dblink  VARCHAR2(10);
          v_statement varchar2(2000);
          CURSOR db_cur
          IS
            SELECT 'test_name' dual_name, 'test_dbl' dual_link
            FROM dual;
        BEGIN
          OPEN db_cur;
          LOOP
            FETCH db_cur INTO v_name,v_dblink;
            EXIT WHEN db_cur%NOTFOUND;
            v_statement := '
            INSERT INTO desktop_lite
              (
                Datestamp,
                pname,
                Db_name,
                Company_name
              )
            SELECT Date_Range,
              '''|| v_name || ''',
              dbname,
              Company_name
              FROM
              (SELECT bu.datestamp Date_Range,
                      (SELECT name FROM v$database@' || v_dblink || ') dbname,
                      bu.name Company_name
               FROM dboltp.s_org_ext@' || v_dblink || ' bu
               INNER JOIN com_unique uusers ON (uusers.bu_id = bu.row_id)
              )';
            dbms_output.put_line (v_statement);
    --            execute immediate v_statement;    -- first look at the statments you produce, then uncomment and test it
           END LOOP;
           CLOSE db_cur;
    END desktop_proc;
    /
    show err
    
    exec desktop_proc
    

    This is my result, it seems that this can work:

    INSERT INTO desktop_lite

    (

    Timestamp,

    PName,

    Db_name,

    Company_name

    )

    SELECT Date_Range,

    "test_name."

    dbname,

    Company_name

    Of

    (SELECT bu.datestamp Date_Range,

    Dbname (SELECT name FROM v$database@test_dbl).

    Bu.Name Company_name

    Dboltp.s_org_ext@test_dbl drunk

    INNER JOIN com_unique uusers ON (uusers.bu_id = bu.row_id)

    )

  • error in the procedure

    Hello

    Please help me to fix errors in the compilation of the following procedure, working with 11g.
    LINE/COL ERROR
    -------- -----------------------------------------------------------------
    1/37 PLS-00103: encountered the symbol "(" quand attend un de la) "
    Next:
    := . ), @ % of default characters
    The symbol ': = ' has been replaced by "("pour continuer.) "

    13/39 PLS-00103: encountered the symbol "(" quand attend un de la) "
    Next:
    , of in bulk

    ----------------------------------------------------------------------------------------------------------------------


    create or replace procedure getvertices (id IN varchar2 (5))

    is

    type ref_cur is REF CURSOR;
    ref_cur c_v;

    type myrec is RECORD (RID number, x, y I number, varchar2 (5));
    REC myrec;

    Start

    Open c_v to select row_number() over (partiton in order of idarpt to idarpt) RID, t.x, t.y XY, testpoly idarpt t, table (sdo_util.getvertices (a.geometry)) where a.idarpt = id;

    loop
    extract the c_v in rec;
    dbms_output.put_line (rec.rid |) » --'|| Rec.x: '-' | Rec.y: '-' | Rec.i);
    end loop;
    close c_v;

    end;

    I think there may be a conflict with the name "id" parameter Try to use something else instead, like "p_id" as shown below.

    SCOTT@orcl_11gR2> create table testpoly
      2    (idarpt       varchar2(5),
      3       geometry  mdsys.sdo_geometry)
      4  /
    
    Table created.
    
    SCOTT@orcl_11gR2> INSERT INTO testpoly VALUES(
      2    'PQRD',
      3    SDO_GEOMETRY(
      4          2003,
      5          NULL,
      6          NULL,
      7          SDO_ELEM_INFO_ARRAY(1,1003,3),
      8          SDO_ORDINATE_ARRAY(1,1, 5,7)
      9          )
     10  );
    
    1 row created.
    
    SCOTT@orcl_11gR2> CREATE OR REPLACE PROCEDURE getvertices
      2    (p_id IN VARCHAR2)
      3  AS
      4    TYPE ref_cur IS REF CURSOR;
      5    c_v ref_cur;
      6    TYPE myrec IS RECORD
      7        (rid     NUMBER,
      8         x     NUMBER,
      9         y     NUMBER,
     10         i     VARCHAR2(5));
     11    rec myrec;
     12  BEGIN
     13    OPEN c_v FOR
     14    SELECT ROW_NUMBER () OVER (PARTITION BY idarpt ORDER BY idarpt) rid,
     15             t.x x, t.y y, idarpt
     16    FROM   testpoly a,
     17             TABLE (SDO_UTIL.GETVERTICES (a.geometry)) t
     18    WHERE  a.idarpt = p_id;
     19    LOOP
     20        FETCH c_v INTO rec;
     21        EXIT WHEN c_v%NOTFOUND;
     22        DBMS_OUTPUT.PUT_LINE
     23          (rec.rid || '--' || rec.x || '--' || rec.y || '--' || rec.i);
     24    END LOOP;
     25    CLOSE c_v;
     26  END getvertices;
     27  /
    
    Procedure created.
    
    SCOTT@orcl_11gR2> show errors
    No errors.
    SCOTT@orcl_11gR2> exec getvertices('PQRD')
    1--1--1--PQRD
    2--5--7--PQRD
    
    PL/SQL procedure successfully completed.
    
  • Dynamics of PL/SQL code in the procedure of the ODI

    Hi guys:

    I have a PL/SQL code to run in an ODI proc that changes because of a loop.

    I have to update the many tables with the same prefix and its sufix is the dynamic part of my PL/SQL. Also, I need to adjust the DT_ETL (I already have a variable in my package with the sysdate) and the limit of a rownum.

    My variables are:

    vGET_CD_BASE*.
    vQTD_REG_UPDATE*.
    vETL_DATE*.

    PL/SQL is described below (with dynamic parts of it as ODI #vXXXXX variables):

    DECLARE
    CURSOR v_Cur IS
    SELECT ROWID KEY_ROW IN GG_DATA. WRK_SN_DET_ITEM_EXTR_PARC_ * #vGET_CD_BASE * WHERE DT_ETL = TO_DATE('01/01/1900','DD/MM/YYYY') and rownum < * #vQTD_REG_UPDATE *;
    TYPE t_Tabela IS TABLE OF ROWID directory INDEX;
    r_Reg t_Tabela;
    BEGIN
    OPEN v_Cur.
    LOOP
    Get the v_Cur COLLECT LOOSE r_Reg LIMIT 100000;
    FORALL i IN 1.r_Reg.COUNT

    UPDATE GG_DATA. WRK_SN_DET_ITEM_EXTR_PARC_ * #vGET_CD_BASE *.
    SET DT_ETL = TO_DATE ('* #vETL_DATE * ',' DD/MM/YYYY HH24:MI:SS')
    WHERE ROWID = r_Reg (i);

    EXIT WHEN v_Cur % NOTFOUND;
    COMMIT;
    END LOOP;
    CLOSE V_Cur;
    COMMIT;
    END;

    What should I change to make it work of PL/SQL in the ODI process?

    Kind regards.
    Luiz Araujo

    Hi Buchu.

    What if you put the name of the table in the variable instead of concatenate in the PL/SQL code.

    This is what I did and seems that worked here.

    (1) create a variable for the name of the table as follows:

    Variable name: var_Table_Dual
    Source code: select 'DOUBLE' double

    (2) create a PRC_VAR_CHANGE procedure

    (3) create a CMD_VAR_CHANGE command

    Command:
    declare vText varchar2 (100): = ";

    Start

    SELECT sysdate in vText #var_DUAL;

    end;

    (4) create a Package for the test.
    First step: Refresh variable
    Second step: call the procedure.

    The result of the operator for the procedure was the following code.
    declare vText varchar2 (100): = ";

    Start

    SELECT sysdate from vText OF #DATA_WAREHOUSE. INC_SYSDATE;

    end;

    Try and let me know.

    Cheers mate!

  • Avoid calling the procedure in the cursor loop

    Hi all

    The following example of procedure the procedure written in cursor loop, is called each time until the end of the cursor loop...
    procedure proc_main is
    DECLARE
     cursor c1 is 
        select e.empno empno
               ,e.ename ename
               ,d.dname dname
               ,d.loc   loc
        from emp e,dept d
        where e.deptno = d.deptno ;
     
    BEGIN
      for i in c1 LOOP
       proc_test(i.empno,i.ename,i.dname,i.loc) ;
       end loop;
    END;
    -----------
    
    PROCEDURE proc_test (p_empno,p_ename,p_dname,p_loc) is
    ---
    ---
    begin
     select * into v1,v2,v3 ..
      from temp_tab
       where col1 =p_empno
        ----
        ----
    
    end;
    What would be the alternative methods to write the procedure above instead to call the procedure inside the cursor for loop
    My idea is to use collections... could you give me the code example using collections to meet the above criteria

    Thank you

    Published by: smile on February 28, 2012 15:45

    The ideal would be to collect all SQL logic and put as much of it in a single SQL statement as possible. It would be also great to determine what is the final outcome of the process and use it as a starting point for your SQL. For example, if the desired result is to upgrade the salaries of the employees where they have an entry in table x, you might find that you can avoid needing to separate the logic between multiple, i.e. instead of procedures

    procedure proc_main is
    DECLARE
     cursor c1 is
        select e.empno empno
               ,e.ename ename
               ,d.dname dname
               ,d.loc   loc
        from emp e,dept d
        where e.deptno = d.deptno ;
    
    BEGIN
      for i in c1 LOOP
       proc_test(i.empno,i.ename,i.dname,i.loc) ;
       end loop;
    END;
    -----------
    
    PROCEDURE proc_test (p_empno,p_ename,p_dname,p_loc) is
    ---
    ---
    begin
     select * into v1,v2,v3 ..
      from temp_tab
       where col1 =p_empno
        ----
        ----
    
        UPDATE
            emp e
        SET
            sal = v2
        WHERE
            e.empno = p_Empno;
    
    end;
    

    You may simply have

    procedure proc_main is
    BEGIN
    
        UPDATE
            emp e
        SET
            sal = ( SELECT
                        t.new_sal
                    FROM
                        temp_tab t
                    WHERE
                        t.empno = e.empno
                   )
        WHERE
            EXISTS
                (   SELECT
                        NULL
                    FROM
                        temp_tab t
                    WHERE
                        t.empno = e.empno
                );
    
    END;
    

    Even if your logic is more complex, you are likely to find that you can merge several of the statements that you could be running in a loop and replace that loop with a join.

    Given the particular structure of what you posted if, instead of calling the procedure in a loop, you can simply move the cursor c1 as a parameter to proc_test that is

    procedure proc_main is
    
        lc_c1   sys_refcursor;
    
    BEGIN
    
        OPEN lc_c1 FOR
        select e.empno empno
               ,e.ename ename
               ,d.dname dname
               ,d.loc   loc
        from emp e,dept d
        where e.deptno = d.deptno ;
    
       proc_test(c1) ;
    
    END;
    -----------
    
    PROCEDURE proc_test (p_Cursor sys_refcursor) is
    
    begin
    
        LOOP
            FETCH ....
    
            ...DO SOMETHING...
    
            EXIT WHEN p_Cursor%NOTFOUND;
    
        END LOOP;
    
        CLOSE p_Cursor;
    END;
    

    But I highly recommend that you consider trying to merge as much of your SQL before considering the approach of cursor.

    HTH

    David

  • pass values of parameter to the procedure stored in the URL, possible?

    Hi, everyone, our system is Apex4.0.2 in Linux CentOS 5 on Oracle 11 g 2, here is the procedure:

    create or replace procedure test_public (Cust_id integer)
    is

    Start
    owa_util.mime_header ("text/xml", FALSE);
    owa_util.mime_header ("application/octet", FALSE);
    -Close the HTTP header
    owa_util.http_header_close;

    HTP.p (DBMS_XMLGEN.getXML ("SELECT * FROM demo_orders where customer_id ='|")) cust_ID));
    end;

    +/+

    the call to the stored procedure is SUCCESSFUL when Test_public has no parameters, as:
    http://myserver/Apex/myschema.test_public (OK)
    the question is: I want to spend the 3 settings in my stored procedure (on production procedure), do not know how?

    Any suggestions are greatly appreciated

    create or replace procedure test_public (param1, param2 IN VARCHAR2, param3 in NUMBER IN number)

    http://myserver/apex/myschema.test_public?param1=¶m2=¶m3=
    
  • Problems with the procedure at the level of the stcok update

    Hi, I am new to Oracle and I have problems with this procedure.
    I had two tables, orders and inventories, and I want to update inventory quantities, when I received the order. For some reason, NULL keeps popping out. Someone help me pls with this!
    The tables are

    create table orders
    (order_no number (4) orders_nn_11 the NOT NULL constraint,)
    item_no number 4 orders_nn_3 of the NOT NULL constraint,
    order_qta number constraint orders_nn_4 NOT NULL,
    ORDER_DATE date NOT NULL constraint orders_nn_2,
    (date of receipt);
    and
    create the table stock
    item_no (4).
    Number of CQI,
    constraint stock_pk foreign key (item_no) references products (item_no);

    the procedure is here, but as I said I am new to this, so I really don't know.


    create or replace
    procedure recues1 (aorder_no in number, aitem_no in numbers, date received)
    is
    quantity number;
    number of quantity2;
    cursor a1 is select qta in stock where item_no = aitem_no;
    cursor a2 is order_qta selection of orders where order_no = aorder_no and item_no = aitem_no;
    Start
    Open a1;
    extract the a1 in quantity2;
    Open a2;
    Fetch a2 in quantity;
    stock update
    Define qta = quantity2 + quantity
    where item_no = aitem_no;
    Update orders
    received game = sysdate
    where order_no = aorder_no;
    near a1;
    Close a2;
    end;
    /

    Thanks in advance

    Hello
    Perhaps because ther eis no COMMIT.
    Or have I missed?

    Something like that

    .....
    
    close a1;
    close a2;
    commit;
    end;
    /
    

    Kind regards
    Bobin

  • Download the procedure not found on the server.

    Hello

    I created a feature to download files using the Oracle (http://download.oracle.com/docs/cd/B31036_01/doc/appdev.22/b28839/up_dn_files.htm#CIHBFCDH) tutorial. The files are copied from the flow table in a custom table named SR_ATTACHMENTS with the following structure:

    Default primary key Type Nullable data column name
    IMAGE_ID NUMBER - 1
    NAME VARCHAR2 (60) Yes.
    Filename VARCHAR2 (60) Yes.
    Mime_type VARCHAR2 (60) Yes.
    DOC_SIZE NUMBER Yes-
    CREATED_BY VARCHAR2 (255) Yes.
    DATE of CREATED_ON Yes-
    Content_type VARCHAR2 (60) Yes.
    BLOB BLOB_CONTENT Yes-
    REQ_ID NUMBER Yes-


    There is a file record in the SR_ATTACHMENTS table:

    SELECT MIME_TYPE, BLOB_CONTENT, filename, DBMS_LOB. GETLENGTH (blob_content)
    OF SR_ATTACHMENTS
    WHERE IMAGE_ID = '41090122232687300';

    Results:
    'MIME_TYPE', 'BLOB_CONTENT', 'FILENAME', 'DBMS_LOB. GETLENGTH (BLOB_CONTENT).
    ' application/pdf', "[no support for data type]", "relish_menu.pdf", "90353"


    Here is the link which is built in the apex in the column links:

    #OWNER # .file_download? p_index = #IMAGE_ID #.


    Here is the link as it appears on the page when the cursor is placed:

    http://My_server:7777/pls/Apex/PRSVCREQDEV.file_download?p_index=41090122232687300



    When the user clicks on the link, I get the following error:
    Not found
    The requested URL /pls/apex/PRSVCREQDEV.file_download was not found on this server.



    Here is the procedure:

    CREATE OR REPLACE PROCEDURE file_download (p_file in number) AS
    v_mime VARCHAR2 (48);
    V_LENGTH NUMBER;
    v_file_name VARCHAR2 (2000);
    Lob_loc BLOB;
    BEGIN
    SELECT MIME_TYPE, BLOB_CONTENT, filename, DBMS_LOB. GETLENGTH (blob_content)
    IN lob_loc, v_file_name, v_mime, v_length
    OF SR_ATTACHMENTS
    WHERE IMAGE_ID = p_file;
    --
    -set up the HTTP header
    --
    -Use a NVL around the mime type and
    -If it is null it the value application/octect
    -application/octect can initiate a download of windows window
    owa_util.mime_header (nvl(v_mime,'application/octet'), FALSE);

    -set the size so that the browser knows how to download
    HTP.p ("Content-length: ' |") v_length);
    -the name of the file will be used by the browser if users only one save as
    HTP.p ('Content-Disposition: attachment; filename = "" | ") Replace (Replace (substr (v_file_name, InStr(v_file_name,'/') + 1), Chr (10), null), Chr (13), null). '"');
    -close the headers
    owa_util.http_header_close;
    -Download the BLOB
    wpg_docload.download_file (Lob_loc);
    end file_download;
    /


    Grants are:

    Name of the constituent object of the privilege dealer
    NO PUBLIC PERFORMANCE NO PRSVCREQDEV FILE_DOWNLOAD


    Any help is greatly appreciated!

    Thank you
    Matt

    Hello

    No problem, by the way, don't forget you can assign points to get useful answers here ;)

    John
    --------------------------------------------
    Blog: http://jes.blogs.shellprompt.net
    Work: http://www.apex-evangelists.com
    Author of Pro Application Express: http://tinyurl.com/3gu7cd

Maybe you are looking for

  • Msconfig - load startup items is grayed out, cannot check or uncheck

    I have a problem with the internet, not loading pages, internet options opens, very slow computer and the gel to the top. I uninstalled IE and reinstalled. I can now go into internet options, then on the first page I load on IE opens, but goes no fur

  • Is there a document identifying all the directives of a config.xml file

    The document found here comprehensive? http://docs.BlackBerry.com/en/developers/deliverables/30182/Creating_a_BB_Widget_configuration_docum... I'm looking for something that tells me that all permissions, all the transition effects, basically everyth

  • Good way to export images for the web (in terms of colors)?

    It is possible has asked a thousand times, but I can't understand it. I tried to searc solutiuon for, but I'm still a Virgin.I have a portrait of a colleague, I need to put on our Web site, but when I export, png is over-red unlike what I see in Phot

  • MS Access 2007-11g - ODBC - ORA-01013

    I have a client that is accessing our databases using MS Access 2007.We have recently updated for customer of Oracle 11 g on the host, it accesses from and now it's getting ORA-01013 error.ODBC connections are system DSNs. To test the ODBC connection

  • Doubt about 660GTX vs 770/780GTX + CPU Performance

    First of all, I'm new here and my English isn't very good, so I'll try to explain it correctly:I really am the owner of:Motherboard: ASUS P8Z68 - V PRO GEN3CPU: Intel i5 - 2500K (no OC)RAM: 8 GB DDR3 1333 mhzGPU: (GB) Nvidia Ti 660GTX OC 2GBSSD: SAMS