Changes in PL/SQL Code

Hi all,
I have the code below and I want to change it according to the questions A and B.
I am new to PL/SQL and I do not undestand the terminology properly. Any sugestion of how to change the code to match question a and b are very welcome.
a. Declare an INDEX BY table dept_table_type of type
departments.department_name. Declare a variable my_dept_table of type
dept_table_type to temporarily store the name of the departments.
b. Declare two variables: loop_count and deptno of type NUMBER. Assign 10 to
loop_count and 0 to deptno.
DECLARE
TYPE departments_table IS TABLE OF departments%ROWTYPE INDEX BY BINARY_INTEGER;
depart departments_table;
BEGIN
SELECT *
BULK COLLECT INTO depart
FROM departments;
FOR i IN depart.FIRST..depart.LAST
LOOP
DBMS_OUTPUT.PUT_LINE(to_char(depart(i).department_id));
END LOOP;
END;
Thank you very much in advance!!!

899335 wrote:
Hi all,
I have the code below and I want to change it according to the questions A and B.
I am new to PL/SQL and I do not undestand the terminology properly. Any sugestion of how to change the code to match question a and b are very welcome.
a. Declare an INDEX BY table dept_table_type of type
departments.department_name. Declare a variable my_dept_table of type
dept_table_type to temporarily store the name of the departments.The type will be very similar to the INDEX BY table called departments_table. The main difference is that each row in a departments table is a
departments%ROWTYPE, but each row in a dept_table_type will be a
departments.department_name%TYPE.
The variable my_dept_table will be very similar to the existing variable dept_table.
By the way, it would be better to use consistent names for the types and variables.
Departments_type would be a better name than departments _table for the type , since it is a TYPE, not a TABLE.
If the column in the table is called department_iname, then department_name_type would be a better name than dept_table_type. You're not abbreviating department in other places, so don't do it here. This type only deals with the deparatment_name column, not the entire row.
My departments_table and my_department_name_table would be better names than depart and my_dept_table.
b. Declare two variables: loop_count and deptno of type NUMBER. Assign 10 to
loop_count and 0 to deptno.You can declare a NUMBER variable anywhen in the DECLARE section, and assign a value to it in the BEGIN section, like this
DECLARE
    x   NUMBER;
BEGIN
    x := 10;
    ...You can also declare a variable and assign a value to it at the same time, in the DECALRE section, like this:
DECLARE
    y   NUMBER := 0;
    ...

Similar Messages

  • How to review implication of database character set change on PL/SQL code?

    Hi,
    We are converting WE8ISO8859P1 oracle db characterset to AL32UTF8. Before conversion, i want to check implication on PL/SQL code for byte based SQL functions.
    What all points to consider while checking implications on PL/SQL code?
    I could find 3 methods on google surfing, SUBSTRB, LENGTHB, INSTRB. What do I check if these methods are used in PL/SQL code?
    What do we check if SUBSTR and LENGTH functions are being used in PL/SQl code?
    What all other methods should I check?
    What do I check in PL/SQL if varchar and char type declarations exist in code?
    How do i check implication of database characterset change to AL32UTF8 for byte bases SQL function.
    Thanks in Advance.
    Regards,
    Rashmi

    There is no quick answer.  Generally, the problem with PL/SQL code is that once you migrate from a single-byte character set (like WE8ISO8859P1) to a multibyte character set (like AL32UTF8), you can no longer assume that one character is one byte. Traditionally, column and PL/SQL variable lengths are expressed in bytes. Therefore, the same string of Western European accented letters may no longer fit into a column or variable after migration, as it may now be longer than the old limit (2 bytes per accented letter compared to 1 byte previously). Depending on how you dealt with column lengths during the migration, for example, if you migrated them to character length semantics, and depending on how relevant columns were declared (%TYPE vs explicit size), you may need to adjust maximum lengths of variables to accommodate longer strings.
    The use of SUBSTR, INSTR, and LENGTH and their byte equivalents needs to be reviewed. You need to understand what the functions are used for. If the SUBSTR function is used to truncate a string to a maximum length of a variable, you may need to change it to SUBSTRB, if the variable's length constraint is still declared in bytes.  However, if the variable's maximum length is now expressed in characters, SUBSTR needs to be used.  However, if SUBSTR is used to extract a functional part of a string (e.g. during parsing), possibly based on result from INSTR, then you should use SUBSTR and INSTR independently of the database character set -- characters matter here, not bytes. On the other hand, if SUBSTR is used to extract a field in a SQL*Loader-like fixed-format input file (e.g. read with UTL_FILE), you may need to standardize on SUBSTRB to make sure that fields are extracted correctly based on defined byte boundaries.
    As you see, there is universal recipe on handling these functions. Their use needs to be reviewed and understood and it should be decided if they are fine as-is or if they need to be replaced with other forms.
    Thanks,
    Sergiusz

  • How to change the profile value in the pl/sql code without making change in the database

    How to change the profile value in the pl/sql code without making change in the database.

    I have program ,where if the profiles 'printer and nunber of copies ' are set at the user level, by default when the report completes the O/p will be sent to the printer mentioned in the set-up. but what user wants is
    if these Profiles are set for the user running this program automatic printing should not be done.

  • Change the mapping generation code from sql*loader to pl/sql

    I want to use a mapping with a flat file operator to generate pl/sql code even if a mapping generate sql*loader code as default.
    I tried to change the Language generation property of the mapping but an API8548 error message is shown. The suggested solution by OWB is to change the language generation code in the property inspector of the mapping.
    I can't use external table because I have to work with a remote machine.
    What i have to do to change the generation code from SQL*Loader to PL/SQL?

    How about breaking this out into 2 mappings? In the first mapping, map a flat file operator to an table using SQL*Loader code. Then define a second mapping using the table as source and therefore generate PL/SQL. Then use process flow to launch the 2nd map to run after completion of first.

  • Change filter sql code to a business name

    All,
    one of my filters is an advanced sql code "Term"."Term Code" = VALUEOF(NQ_SESSION.CSA_Analysis_Term)
    when i add the filter to the report (Add Filter) the user does not understand the above code,
    and I am unable to find a way to add a name to make it more meaningful to the users.
    have anyone experimented with this
    thanks

    Hi Kishore,
    I changed it in the prompt now and I set the Server Variable to NQ_SESSION.CSA_Analysis_Term
    however I am experiencing another issue. If the value from the prompt is the default value from the server then I see this filter in my filter header
    "Term Code Desc is equal to NQ_SESSION.CSA_Analysis_Term"
    if I select a another value from the dropdown box then I see this
    Term Code Desc is equal to (2010 Fall) which is exactly what I am looking for.
    the filter in the report is setup as "Term Code Desc is prompted"
    Thanks

  • Track pl/sql code change.

    HI,
    Is ther any way , we can track the pl/sql code change ? I've already running a trigger, which track who created the objects, but there is no way, I can find that
    The user made any change to it. for exaple, if there are proc1 exist in database and someone copy the code from sql developer run it once again, without made any change. According to you, what cab be done to counter the situtaion?
    hare krishna
    Alok

    I am agree, in the VSS we are not able to capture the code changes by the developer.
    You can write a procedure which will copy the text from all_source table to a file according some parameter( You can use some table column value with the user name , SID , and obejct type value, because it will take too many space to store for all the create syntax, then before copy the text from the all_source table it will check for that table user_name, SID and object type entry, if it will get then it will copy the text and store in a file through utl_file, with the file name as SID+user_name+datetime).
    Call this procedure in the trigger, I think you will get the result when you want for a particular user or all the users.
    Thanks
    SUN

  • Getting error while compiling this pl/sql code

    Hi,
    I am trying to execute the below block of pl/sql code and i encountering an error. i tried all possible combination of paranthesis and quotes. still giving error. can someone please help?
    IF inserting THEN
    pk_imdb_audit.p_ins_characteristic_a_t
    (in_'||rpad(column_name,35,' ')||'=> pk_imdb_audit.v_action_inserting,'
    WHEN max_col = column_id THEN
    in_'||rpad(column_name,35,' ')||'=> '||lower(in_col_value)||');'
    ELSE
    ' in_'||rpad(column_name,35,' ')||'=> '||lower(in_col_value)||','
    END text,
    table_name,
    column_id,
    2 disp_ord
    error snapshot:-
    ORA-06550: line 14, column 14:
    PLS-00103: Encountered the symbol "||rpad(column_name,35," when expecting one of the following:
    . ( ) , * @ % & | = - + < / > at in is mod remainder not
    range rem => .. <an exponent (**)> <> or != or ~= >= <= <>
    and or like LIKE2_ LIKE4_ LIKEC_ as between from using ||
    multiset member SUBMULTISET_
    The symbol "( was inserted before "||rpad(column_name,35," to continue.
    ORA-06550: line 15, column 13:
    PLS-00103: Encountered the symbol "WHEN" when expecting one of th

    Hi,
    here is a 'parseable' version of your query, but there is numerous ways to improve what you want to do (not sure even if the query is giving you what you're expecting from it):
    SELECT text
    FROM   (SELECT (CASE
                       WHEN min_col = max_col THEN    'CREATE OR REPLACE TRIGGER '
                                                   || SUBSTR(column_name,
                                                             1,
                                                             4
                                                   || 'aud
    AFTER INSERT
    OR UPDATE
    OF '
                                                   || column_name
                                                   || ',
    OR DELETE ON imdb.'
                                                   || table_name
                                                   || '
    FOR EACH ROW'
                       ELSE(CASE
                               WHEN min_col = column_id THEN    'CREATE OR REPLACE TRIGGER '
                                                             || SUBSTR(column_name,
                                                                       1,
                                                                       4
                                                             || 'aud
    AFTER INSERT
    OR UPDATE
    OF '
                                                             || column_name
                                                             || ','
                               ELSE(CASE
                                       WHEN max_col = column_id THEN    ' '
                                                                     || column_name
                                                                     || '
    OR DELETE ON imdb.'
                                                                     || table_name
                                                                     || '
    FOR EACH ROW'
                                       ELSE(CASE
                                               WHEN column_id IS NULL THEN    'CREATE OR REPLACE TRIGGER '
                                                                           || SUBSTR
                                                                                 (column_name,
                                                                                  1,
                                                                                  4
                                                                           || 'aud
    AFTER INSERT
    OR UPDATE
    OR DELETE ON imdb.'
                                                                           || table_name
                                               ELSE    ' '
                                                    || column_name
                                                    || ','
                                            END
                                    END
                            END
                    END
                   ) text,
                   table_name1 table_name,
                   column_id,
                   1 disp_ord
            FROM   (SELECT LOWER(REPLACE(column_name,
                                         'O_',
                                        )) column_name,                   /*changing O to O_*/
                           LOWER(REPLACE(t.table_name,
                                         '_A_',
                                        )) table_name,
                           LOWER(t.table_name) table_name1,
                           c.column_id,
                           MIN(column_id) OVER(PARTITION BY c.table_name) min_col,
                           MAX(column_id) OVER(PARTITION BY c.table_name) max_col
                    FROM   all_tab_columns c,
                           (SELECT object_name table_name
                            FROM   all_objects
                            WHERE  TRUNC(created) = TRUNC(SYSDATE)
                            AND    object_name = 'CHARACTERISTIC_A_T') t
    --AND object_name LIKE 'IMDB/_A/_%' ESCAPE '/') t /*commented this line for testing*/
                    WHERE  c.table_name(+) = t.table_name
                    AND    SUBSTR(column_name(+),
                                  1,
                                  2
                                 ) = 'O_'))
              /*changed the substring condition to match new changes*/
    UNION ALL
    SELECT (CASE
               WHEN min_col = column_id THEN    'DECLARE
    BEGIN
    IF inserting THEN
    pk_imdb_audit.p_ins_characteristic_a_t
    (in_'
                                             || RPAD(column_name,
                                                     35,
                                             || '=> pk_imdb_audit.v_action_inserting,'
               ELSE(CASE
                       WHEN max_col = column_id THEN    'in_'
                                                     || RPAD(column_name,
                                                             35,
                                                     || '=> '
                                                     || LOWER(in_col_value)
                                                     || ');'
                       ELSE    ' in_'
                            || RPAD(column_name,
                                    35,
                            || '=> '
                            || LOWER(in_col_value)
                            || ','
                    END
            END
           ) text /*,
           table_name,
           column_id,
           2 disp_ord*/
    FROM   (SELECT table_name,
                   column_name,
                   column_id,
                   min_col,
                   max_col,
                   in_col_value,
                   trg_header,
                      'in_'
                   || RPAD(column_name,
                           35,
                   || '=> '
                   || LOWER(in_col_value)
                   || ',' in_col
            FROM   (SELECT   LOWER(c.column_name) column_name,
                             LOWER(c.table_name) table_name,
                             c.column_id,
                             (CASE
                                 WHEN SUBSTR(column_name,
                                             1,
                                             2
                                            ) = 'N_' THEN
                                   /*changed the substring condition to match the new change*/
                                                            ':NEW.'
                                                         || REPLACE
                                                               (column_name,
                                                                'N_',
                                                                'N_'
                                            /*changed the condition to match new requirement*/
                                 WHEN SUBSTR(column_name,
                                             1,
                                             2
                                            ) = 'O_' THEN
                                   /*changed the substring condition to match the new change*/
                                                         'NULL'
                                 ELSE    ':NEW.'
                                      || REPLACE(column_name,
                                                 '_A_',
                              END
                             ) in_col_value,
                             LOWER(SUBSTR(column_name,
                                          1,
                                          3
                                         )) trg_header,
                             MIN(column_id) OVER(PARTITION BY c.table_name) min_col,
                             MAX(column_id) OVER(PARTITION BY c.table_name) max_col
                    FROM     all_tab_columns c
                    WHERE    c.table_name IN(
                                SELECT object_name
                                FROM   all_objects
                                WHERE  TRUNC(created) = TRUNC(SYSDATE)
                                AND    object_name = 'CHARACTERISTIC_A_T')
                    ORDER BY c.table_name,
                             c.column_id))

  • Funny bug in pl sql code

    Hi,
    I have written a code to upload data from csv file to oracle table. it gives me a funny error. I have given below the sample contents of .csv file
    "4951","TCSPL (TRADING A/C)","470","TISCO",20050419,"P",362.6550,212,0.00
    "4951","TCSPL (TRADING A/C)","470","TISCO",20050419,"S",361.7500,212,-191.86
    "4951","TCSPL (TRADING A/C)","477","ASHOKLEY",20050928,"P",28.5000,200,0.00
    "4951","TCSPL (TRADING A/C)","477","ASHOKLEY",20050928,"S",28.4960,200,-0.80
    for the first time if i run the sql code it uploads first 2 records and does not upload third record, if i change the figure of =-191.86 to 191.86 (if i remove - mark ) then it uploads all the records, if i reverse it back it does not the third record, the structure of the table is like this ( the data column where this data get inserted is number(15,4) datatype)
    this type of problem is happening with that perticular row only, though several such kind of combination is there in the csv file.
    sQL> desc UNITISCLTRXN
    Name Null? Type
    CLCODE VARCHAR2(10)
    CLNAME VARCHAR2(120)
    SCCODE VARCHAR2(10)
    NSESYMBOL VARCHAR2(10)
    TRDDATE DATE
    PURSAL VARCHAR2(1)
    RATE NUMBER(15,6)
    CLQTY NUMBER(10,2)
    PROFIT NUMBER(15,4)
    the sql code i have written is as below
    PROCEDURE upload_unitiscltrxn IS
    file_id text_io.file_type;
         crec unitiscltrxn%rowtype;
    linebuf VARCHAR2(1000);
    i number:=1;
    len number:=0;
    spos number:=0;
    tpos number:=0;
    var varchar2(1000);
    mon varchar2(5);
    cnt number:=0;
         errnum NUMBER := ERROR_CODE;
         errtxt VARCHAR2(80) := ERROR_TEXT;
    errtyp VARCHAR2(3) := ERROR_TYPE;
    begin
              Delete from unitiscltrxn;
              File_id := Text_IO.Fopen('M:\UNITIS\db\final.csv', 'r');
         Text_IO.Get_Line(File_id,linebuf);
              cnt :=1;
              while linebuf is not null loop
         IF CNT<>1 THEN
              Text_IO.Get_Line(File_id,linebuf);
         END IF;     
              cnt :=1+cnt;
         len := length(linebuf);
         spos :=1;
         i:=1;
         tpos :=0;
         var:='';
         mon:='';     
         while i < 10 loop
         tpos := instr(linebuf,',',spos);
         if tpos >0 then
              var :=substr(linebuf,spos,tpos-spos);
         else
              var :=substr(linebuf,spos);
         end if;     
              ----------get values into variable.------------------     
         If i =1 then
              Crec.clcode := Replace(var,'"','');
         ElsIf     i =2 then
              Crec.clname := Replace(var,'"','');
         ElsIf     i =3 then
              Crec.sccode := Replace(var,'"','');
         ElsIf     i =4 then
              Crec.nsesymbol := Replace(var,'"','');
         ElsIf     i =5 then
              select Decode(substr(var,5,2),1,'JAN',2,'FEB',3,'MAR',4,'APR',5,'MAY',6,'JUN',7,'JUL',8,'AUG',
              9,'SEP',10,'OCT',11,'NOV',12,'DEC') into mon from dual;
              Crec.trddate := to_date(substr(var,7)||'-'||mon||'-'||substr(var,1,4),'DD-MON-YYYY');
         ElsIf     i =6 then
              If var = '"P"' Then
                   Crec.pursal :='P';
              Elsif     var = '"S"' Then
                   Crec.pursal :='S';
              end if;     
              --Crec.pursal := var;
         ElsIf     i =7 then
              Crec.rate := var;
         ElsIf     i =8 then
              Crec.clqty := var;
         ElsIf     i =9 then
              Crec.profit := var;
         End If;     
         i:=i+1;
         spos:=tpos+1;
         end loop;
         INSERT INTO UNITISCLTRXN VALUES(crec.clcode, crec.clname ,crec.sccode ,crec.nsesymbol,
         crec.trddate,crec.pursal,crec.rate,crec.clqty,crec.profit);
         text_io.new_line(file_id, 1);
         End loop;     
         EXCEPTION
         WHEN no_data_found THEN
         Text_IO.Put_Line('Closing the file...');
         Text_IO.Fclose(file_ID);
    WHEN OTHERS THEN
         Message(errtyp||'-'||TO_CHAR(errnum)||': '||errtxt||'FF'||DBMS_ERROR_CODE);
         Message(errtyp||'-'||TO_CHAR(errnum)||': '||errtxt);
    END;
    END;
    Thanks
    Uday

    Hi
    Try to debug you procedure inserting a better exception handling and some dbms_output.put_line.
    E.g.
    ElsIf i =9 then
    Crec.profit := var;
    dbms_output.put_line(var || '  -  ' Crec.profit);
    End If; Try to put the exception handling in the loop ... while i < 10 loop ... .
    I don't think that it's an Oracle bug. It's a human error in your code!
    Bye, Aron

  • Scheduling of discoverer report via concurrent program or pl/sql code

    Hi All,
    I am beginner on Discoverer Report. As per my client requirements we need to do the scheduling of discoverer report rather than manually run it every week. Also we need to do this job by help of concurrent program or pl/sql code. But I don’t know how to scheduled the discoverer report.
    Please any one help me or provide pl/sql code.
    Thanks in Advance
    Subhas Samanta

    This is one of those questions that has been asked on the forum for years now and the answer really hasn't changed in that - command line using .BAT files, command line using VBasic (Rod's expertise) and Java potential via Plus.
    You can search the forum for the fully documented answers to this but basically:
    1. you can use Disco Desktop - NOT Plus or Viewer - with good ol' MS BAT files using the command line interface
    2. you can use Disco Desktop - NOT Plus or Viewer - with good ol' MS BAT files using VBasic calls
    3. I think - although never have seen - using Java command line interface to control it via a Java program
    oh yah ...
    4. if you're running Oracle Apps I believe you can get the Concurrent Manager to run the Disco report for you as well (another of Rod's expertises)
    Russ
    Edited by: RussProudman on Oct 30, 2008 2:40 PM

  • Dynamic PL/SQL code into ODI Procedure

    Hi guys:
    I have a PL/SQL code to execute into a ODI proc that changes because of a loop.
    I have to update N tables that have the same prefix and its sufix is the dynamic part of my PL/SQL. Also I have to set the DT_ETL (I already have a variable in my package with the sysdate) and the limit of a rownum.
    These are my variables:
    vGET_CD_BASE*
    vQTD_REG_UPDATE*
    vETL_DATE*
    The PL/SQL is described below (with the dynamic parts of it as ODI variables #vXXXXX):
    DECLARE
    CURSOR v_Cur IS
    SELECT ROWID KEY_ROW FROM 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 INDEX BY BINARY_INTEGER;
    r_Reg t_Tabela;
    BEGIN
    OPEN v_Cur;
    LOOP
    FETCH v_Cur BULK COLLECT INTO 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 do I have to change to make this PL/SQL works in ODI Procedure?
    Regards.
    Luiz Araujo

    Luiz,
    One way you could do is by using the "Command on Source" and "Command on Target" feature of an ODI procedure:
    In Command on Source, you can write query like:
    >
    select vGET_CD_BASE, vQTD_REG_UPDATE, vETL_DATE from some_configuration_table_containing_n_rows
    >
    In Command on Target, you can write:
    >
    DECLARE
    CURSOR v_Cur IS
    SELECT ROWID KEY_ROW FROM 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 INDEX BY BINARY_INTEGER;
    r_Reg t_Tabela;
    BEGIN
    OPEN v_Cur;
    LOOP
    FETCH v_Cur BULK COLLECT INTO 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;
    >
    So, for "n" records that are returned by the source query, your PL/SQL package will run "n" times, each time substituting the values of vGET_CD_BASE, vQTD_REG_UPDATE, vETL_DATE respectively.

  • How can i identify the environment name or database name in the PL/SQL code

    Hi,
    I am using UTL_FILE to genearate the files.,
    My problem is, I have to design the common sql file , which can be executed in 2 diffrent environments ( Say QA & DEV ) , with no parameters. It has to identify the environment and based on the environment , it has to generate the concern files.,
    The only change needs to be incorporated is , file names , which will change based on the environment.,
    can nay one tell me , how can i identify the environment name or database name in the PL/SQL code ??
    Raja

    In this case, USEC_GI_DEV.NA.XXXNET.NET is a TNS alias. That alias exists only on the client machine. There is no way to access that information on the database server.
    You would have to find something in the v$database or v$instance table that uniquely identifies the database (and you may need some help from the DBAs to do this because you need to ensure that the data element you choose is compatible with whatever refresh process(es) are used in your environment).
    Now, if you are writing a stand-alone SQL*Plus script, SQL*Plus, as a client tool, does have access to the TNS alias in later versions. But that is a client-side determination, not a server-side determination.
    Justin

  • Can the g_f0x variables be accessed in PL/SQL code in page rendering?

    Hi,
    I have set a button in a tabular form that runs a dynamic action made up of 2 parts in sequence:
    (1) a PL/SQL code that updates a collection using g_f01 (selected items in the tabular form)
    (2) a javascript that calls apex.server.process to display the selected items in a region
    All this code is in the page rendering section being called from a button,and thats the only way it seems to fire PL/SQL and javascript from a button
    one after the other.
    I have a page process called "submit" that does a loop through the g_f01 values again and updates the collection again just to check.
    Now, the PL/SQL code in the dynamic action does not see any selected values in the g_f01 array,while the code in the "submit" page process.
    sees them correctly. I've used debug to check.
    Question: Can the g_f0x values of a tabular form columns be accessed through a PL/SQL in page rendering, or can they
    only be accessed through a page process?
    If not, can the g_f0x values be saved in a global array somewhere although that will make things more complicated.
    Leckraj

    leckj wrote:
    Hi Jorge,
    Thanks for answering,
    If only I had known, because my whole cunning plan was based on this!
    Been in APEX only for some 2 weeks, and its a whole new environment coming from the quiet forms6i way
    of doing things, and sometimes a bit strange.
    I am using collections in fact as my tabular form is based on a view based on a collection.
    However, the cells in the form only seem to be placeholders and any changes seem to be made to only the
    g_f0x arrays, and the underlying collection members have to be updated programatically.
    So if I lose the g_f0x values I cannot update the collection. chicken and eggs.
    The flow needs to run a PL/SQL to update the collection,followed by a javascript call to apex.server.process to print the values in a region.
    Yon cannot have javascript as a page process, and g_f0x values in the rendering part, so is there anywhere apart from a 2-step dynamic action,
    that we can force the run of PL/SQL code followed by javascript?This sounds excessively complicated. The normal APEX approach would be to submit the page, and update the collection from the tabular form <tt>apex_application.g_fxx</tt> array values in a post-submit process. The updated collection values can be displayed in a region using SQL or PL/SQL on page show without recourse to JavaScript.
    This early in your use of APEX, why are you not just using the basic technique?

  • Accessing Secured Web Services fromPL/SQL  Code.

    Hi ,
    This is an urgent requirement.We need to call a Web Sercured which is secured(That we need Authenticate using Digital Signatures).I don't how to call a Secured web service from PL/SQL code.with java it is possible.
    Can anyone help me in confoguring/Writing code to call web services with Digital Certificates.
    Regards,
    Ram

    In the XmlDigester class you would have to change the following 2 functions...
    public int Compare(Object x, Object y)
    XmlAttribute lhs = (XmlAttribute)x;
    XmlAttribute rhs = (XmlAttribute)y;
    string ls = lhs.NamespaceURI;
    string rs = rhs.NamespaceURI;
    if ((ls == rs) || (ls.Equals(rs) && ls != null && rs != null))
    ls = lhs.LocalName;
    rs = rhs.LocalName;
    if (ls == null)
    return -1;
    if (rs == null)
    return 1;
    byte[] larr = Encoding.UTF8.GetBytes(ls);
    byte[] rarr = Encoding.UTF8.GetBytes(rs);
    int len = Math.Min(larr.Length, rarr.Length);
    for (int i = 0; i < len; i++)
    int li = (int)(larr[i] & 0xFF);
    int ri = (int)(rarr[i] & 0xFF);
    int d = li - ri;
    if (d != 0)
    return d;
    return larr.Length - rarr.Length;
    private void Serialize(string s, Stream outStream)
    byte[] bytes = Encoding.UTF8.GetBytes(s);
    int len = bytes.Length;
    Serialize((byte)(len >> 8), outStream);
    Serialize((byte)(len), outStream);
    Serialize(bytes, outStream);
    That should do the trick.

  • Comparing PL/SQL code from different database

    Hi,
    I have 3 databases(development, test and production) lying in 3 different servers. I wanted to check if all the databases have the same PL/SQL code.
    is there a automatic ways of doing that. If not is there any best practices that can be followed
    I use oracle 10g
    Thanks,
    DJ

    Dont you have a Change Management System in place. How do you do your deployment. What is the versoin control system you use?
    When you deploy your code in some database dont you store the details some where?
    In database source code is available at ALL_SOURCE. You can query that and compare. But its never a good idea.

  • Execute all SQL code as individual Oracle user, not APEX_PUBLIC_USER

    Is it possible to get APEX to execute SQL code as the user's existing Oracle database user instead of APEX_PUBLIC_USER?
    Besides having all of the security already defined for each of the existing users at the database level, the existing application also handles generating audit trails with triggers that pull the username executing the SQL instead of accepting passed values. At the moment APEX_PUBLIC_USER is plastered everywhere as the user that generated the changes.

    rcy_evdriver wrote:
    Is it possible to get APEX to execute SQL code as the user's existing Oracle database user instead of APEX_PUBLIC_USER? No. See:
    {message:id=926724}
    {message:id=1224601}
    {message:id=1606515}
    Application Express and parsing of SQL
    Besides having all of the security already defined for each of the existing users at the database level, the existing application also handles generating audit trails with triggers that pull the username executing the SQL instead of accepting passed values. At the moment APEX_PUBLIC_USER is plastered everywhere as the user that generated the changes.Using DAD Credentials Verification will cause the database user to be returned by the <tt>USER</tt> pseudo-column. (However just because you can do this, it doesn't mean you should.)
    {message:id=9680421}
    Why are you asking this? +"At the moment APEX_PUBLIC_USER is plastered everywhere as the user that generated the changes"+ indicates that it might be a bit late to be making fundamental discoveries about APEX and database security?

Maybe you are looking for