dbms_xmlgen using the pl - sql record type

Hello

I want the pl - sql record type and want to generate xml data. Registration of dbms_xmlgen access pl - sql can type instead of the query?

OR, please let me know any other packet pass pl - sql record type and generate XML data.

Thanks in advance

Registration of dbms_xmlgen access pl - sql can type instead of the query?

Do not think, but you can't go the individual components of record:

SQL> declare
  type rec is record
  (
    a   int,
    b   varchar2 (30)
  );

  r     rec;
  ctx   int;
  x     xmltype;
begin
  r.a := 1;
  r.b := 'Michael';

  ctx := dbms_xmlgen.newcontext ('select :x id, :y name from dual');
  dbms_xmlgen.setbindvalue (ctx, 'x', r.a);
  dbms_xmlgen.setbindvalue (ctx, 'y', r.b);
  x := dbms_xmlgen.getxmltype (ctx);
  dbms_output.put_line (x.getstringval ());
  dbms_xmlgen.closecontext (ctx);
end;
/

 
  1
  Michael
 

PL/SQL procedure successfully completed.

?

Tags: Database

Similar Questions

  • Android APP and Native application using the same push record ID

    Hello

    We have an Android existing converted app we use for BB10 platform that we are in the process of gradually. Replace this app is an application of BB10 Native with the same name and features.

    My question is that I have to get a new record ID to push for the new Native application or can I use the existing production record ID?

    Ideally, I would like to migrate my users off the coast of the old version of the application to the new with the least problems for customers.

    Thank you

    Andrew

    You should be able to use the same ID for this record.

  • There seems to be a problem with the soft ware.  We use the CS6 for Records services and when we try to save the record, part of the record is stored. The record to be saved as an mp3 file is 70 to 100 KB but recently only 3 KB are generally

    There seems to be a problem with the software.  We use the CS6 for Records services and when we try to save the record, part of the record is stored.  Usually the recording to be saved as an mp3 file is 70 to 100 KB but recently only 3 KB are recorded.  What should I do to fix this?

    You may need to reset your preferences of hearing files stored in C:\Users\"username"\AppData\Roaming\Adobe\Audition\5.0. If you rename this folder in 5.0.bak that hearing won't find it when you open the next time if it will recreate a new settings with the default settings folder. See if hearing then works as expected.

  • Retrieve and display a result set using the dynamic sql?

    Hi all

    How would display a result set in Oracle using the dynamic SQL? Reason being, the table where I'd retrieve and display the result set is a GLOBAL TEMP TABLE created in a stored procedure. If I try to use the loop as usual, the compiler complains that the table does not exist. This makes sense because the compiler does not recognize the table because it is created dynamically. Here is an example:

    create or replace PROCEDURE maketemptab IS
    sql_stmt VARCHAR2 (500);
    OutputString VARCHAR2 (50);

    BEGIN
    -create temporary table
    sql_stmt: = ' CREATE of TABLE TEMPORARY GLOBAL globtemptab (id NUMBER, col1 VARCHAR2 (50))';
    EXECUTE IMMEDIATE sql_stmt;
    dbms_output.put_line ('... created table ');

    -Insert a row into the temporary table
    sql_stmt: = "INSERT INTO globtemptab values (1, 'some data of a test')';"
    EXECUTE IMMEDIATE sql_stmt;
    dbms_output.put_line ('... inserted row ');

    -Insert a row into the temporary table
    sql_stmt: = ' INSERT INTO globtemptab values (2, "some more test data");
    EXECUTE IMMEDIATE sql_stmt;
    dbms_output.put_line ('... inserted row ');

    -Select the row on temporary table
    sql_stmt: = 'SELECT col1 FROM globtemptab WHERE id = 1';
    EXECUTE IMMEDIATE sql_stmt INTO outputstring;
    dbms_output.put_line ('... selected line: ' | outputstring);

    -drop temporary table
    sql_stmt: = 'DROP TABLE globtemptab;
    EXECUTE IMMEDIATE sql_stmt;
    dbms_output.put_line ('... moved table ');

    -display the result set
    for tabdata loop (select col1 from globtemptab)
    dbms_output.put_line ('... test of recovered data are' | tabdata.col1)
    end loop;
    end;


    In short, how to rewrite the SQL below the comment "to display the result set" using the dynamic sql?

    Thank you
    Amedeo.

    Hello

    Try this:

    CREATE OR REPLACE PROCEDURE maketemptab IS
       sql_stmt     VARCHAR2(500);
       outputstring VARCHAR2(50);
       v_cursor     SYS_REFCURSOR;
       v_col1       VARCHAR2(30);
    BEGIN
       -- create temp table
       sql_stmt := 'CREATE GLOBAL TEMPORARY TABLE globtemptab(id NUMBER, col1 VARCHAR2(50))';
       EXECUTE IMMEDIATE sql_stmt;
       dbms_output.put_line('...table created');
    
       -- insert row into temp table
       sql_stmt := 'INSERT INTO globtemptab values (1, ''some test data'')';
       EXECUTE IMMEDIATE sql_stmt;
       dbms_output.put_line('...row inserted');
    
       -- insert row into temp table
       sql_stmt := 'INSERT INTO globtemptab values (2, ''some more test data'')';
       EXECUTE IMMEDIATE sql_stmt;
       dbms_output.put_line('...row inserted');
    
       -- select row from temp table
       sql_stmt := 'SELECT col1 FROM globtemptab WHERE id=1';
       EXECUTE IMMEDIATE sql_stmt
          INTO outputstring;
       dbms_output.put_line('...row selected: ' || outputstring);
    
       OPEN v_cursor FOR 'SELECT col1 FROM globtemptab';
    
       LOOP
          FETCH v_cursor
             INTO v_col1;
          EXIT WHEN v_cursor%NOTFOUND;
          dbms_output.put_line('...test data retrieved is' || v_col1);
       END LOOP;
       CLOSE v_cursor;
    
       -- drop temp table
       sql_stmt := 'DROP TABLE globtemptab';
       EXECUTE IMMEDIATE sql_stmt;
       dbms_output.put_line('...table dropped');
    END;
    /
    

    Kind regards

  • Error: PL/SQL ORA - 00932 data type incompatible when using the value of LONG type

    Hello:

    I use a PL/SQL job script where I use a value of type LONG in a cursor. When I run it, I get:

    Incompatible data type of PL/SQL ORA-00932: expected NUMBER got LONG
    set serveroutput ON SIZE 1000000
    set heading off                
    set feedback off                
    set trimspool off               
    set echo off 
    set term off                   
    set pagesize 0         
    
    SPOOL &so_outfile;
    
    
    
    
    DECLARE
      v_data_file          varchar2(30);
     --   v_sch_code            varchar2(10);
     --   v_instance_name       varchar2(10);
        ws_path            payroll.pybutfl.pybutfl_utl_file_path%TYPE; 
        v_data_line           VARCHAR2 (2000)                              := NULL;
        fhandle_o             UTL_FILE.file_type;
        v_line_count          NUMBER                                       := 0;
        v_selected_count      NUMBER                                       := 0;
        v_error_count         NUMBER                                       := 0;
        v_written_count       NUMBER                                       := 0;
        v_error_text          VARCHAR2 (50)       := ' AMACONF_ERR: Unable to write the line. ';
        v_errm                VARCHAR2 (255);
        v_sqlerrm             VARCHAR2 (255);
        v_payment_type        VARCHAR2(10);
    
    
    CURSOR C1 IS
    select RTRIM
          ( 
            AMRCONF_PIDM_ERR            ||'|'||
            AMRCONF_IDEN_CODE_ERR       ||'|'||
            AMRCONF_ENTRY_DATE_ERR      ||'|'||
            AMRCONF_CONFID_IND_ERR      ||'|'||
           *AMRCONF_COMMENT_ERR        ||'|'||*
            AMRSUBJ_SUBJ_CODE_ERR       ||'|'||
            ERROR_CODE                  ||'|'||
            ERROR_CODE_TEXT                 ) data_line
            from WSUALUMNI.AMRCONF_ERR;
    
    
    
    BEGIN
    
    
    DBMS_OUTPUT.put_line ('Program Generating AMACOMT Mass Update Error File ');
    IF UTL_FILE.is_open (fhandle_o)
        THEN   
       UTL_FILE.fclose (fhandle_o);
    END IF;
    
    /* Name The File Here */
    v_data_file := ('Amaconf_error.txt');
    
    
    
    SELECT RTRIM (pybutfl_utl_file_path)
          INTO ws_path
          FROM payroll.pybutfl;
          
          fhandle_o := UTL_FILE.fopen (ws_path, v_data_file, 'w');
          DBMS_OUTPUT.put_line ('UTLFILE file for this run is: ' || ws_path||'/'||v_data_file);
          v_written_count := 0;   
    
    FOR c1_rec IN C1 LOOP
          BEGIN
            v_selected_count := v_selected_count + 1;
            v_data_line := rtrim(c1_rec.data_line);
            UTL_FILE.put_line (fhandle_o, v_data_line);
            v_written_count := v_written_count + 1;
        EXCEPTION
         WHEN OTHERS
          THEN
           DBMS_OUTPUT.put_line (v_error_text);
           v_error_count := v_error_count + 1;
        END;
    END LOOP;
    
         DBMS_OUTPUT.put_line ('Number of Records Selected: ' || v_selected_count);
         DBMS_OUTPUT.put_line ('Number of Records Written: ' || v_written_count);
    
          IF UTL_FILE.is_open (fhandle_o)
          THEN
             UTL_FILE.fclose (fhandle_o);
          END IF;
    
    END;
    /
    
    SPOOL OFF;
    If I comment on the ' AMRCONF_COMMENT_ERR |'| ' | ' line, then the script works fine. The table has been created as:
    Create Table WSUALUMNI.AMRCONF_ERR
    (
        AMRCONF_PIDM_ERR             NUMBER (8)    NOT NULL,
        AMRCONF_IDEN_CODE_ERR        VARCHAR2(5)   NOT NULL,
        AMRCONF_ENTRY_DATE_ERR       DATE          NOT NULL,
        AMRCONF_CONFID_IND_ERR       VARCHAR2(1),
        AMRCONF_COMMENT_ERR          LONG,          
        AMRSUBJ_SUBJ_CODE_ERR        VARCHAR2(5)   NOT NULL,
        ERROR_CODE                   VARCHAR2(12)  NOT NULL,
        ERROR_CODE_TEXT              VARCHAR2(50)  NOT NULL
    ); 
    I don't understand what the problem here is in the script.

    Hello
    Feew suggestions
    (1) LONG is an obsolete type so if possible start working on this column change
    (2) CLOB will be your favorite type of data on long.
    (3) you cannot use RTRIM on long.

    Here's a very quick example

    drop table h
    create table h (x long,y varchar2(100))
    select rtrim(x) from h
    select rtrim(y) from h
    

    Solution:
    [http://www.oracle.com/technology/oramag/code/tips2003/052503.html]

    need to better implement the clob data type and

    drop table h
    create table h (x clob,y varchar2(100))
    select  dbms_lob.substr( x, 4000, 1 ) from h
    select rtrim(y) from h
    

    See you soon!
    Bobin

  • Looking for example of the Manager to OBTAIN with the PL/SQL source type

    Hello

    I currently have a Manager GET job with a running QUERY source type in ADR 3.0.  The call returns the number of records (hundreds, or even thousands of 10) in JSON and allows the user to navigate through the results.

    The call accepts several parameters that I convey just in the place where the clause of the query in the Manager.  Data is retrieved by the beach date (s).

    To prevent queries runaway with ranges for a long time, I've implemented a logic in the sql statement to limit the applicant.  The applicant requested an error thrown instead.  There are other limits that I'm imposing on other entries I need to provide useful errors for example.

    I would like to change the call GET use PL/SQL type instead of the type of REQUEST so that I can do validation on entries and send useful return error messages if necessary, however I can't find examples online.

    Are there any examples (or alternatives) would be greatly appreciated.

    Thank you

    Anthony

    Hello

    You can use the Pipelined functions to generate your recordset plsql and then just use a select statement of the function in the pipeline in the service definition.

  • Error using BULK collect with RECORD TYPE

    Hello

    I wrote a simple procedure to declare a record type & then by a variable of type NESTED table.

    I then selects the data using COLLECT in BULK & trying to access it via a LOOP... We get an ERROR.

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

    CREATE OR REPLACE PROCEDURE sp_test_bulkcollect
    IS

    TYPE rec_type () IS RENDERING
    emp_id VARCHAR2 (20).
    level_id NUMBER
    );

    TYPE v_rec_type IS TABLE OF THE rec_type;

    BEGIN

    SELECT employe_id, level_id
    LOOSE COLLECTION v_rec_type
    OF portfolio_exec_level_mapping
    WHERE portfolio_execp_id = 2851852;

    FOR indx IN v_rec_type. FIRST... v_rec_type. LAST
    LOOP

    dbms_output.put_line ('Emp-' | v_rec_type.emp_id (indx) |) » '|| v_rec_type.level_id (indx));

    END LOOP;

    END;
    -----------------------------------------------------------------------------------------------------------------------------------

    Here is the ERROR I get...


    -Errors of compilation for the PROCEDURE DOMRATBDTESTUSER. SP_TEST_BULKCOLLECT

    Error: PLS-00321: expression "V_REC_TYPE" is not appropriate for the left side of an assignment statement
    Online: 15
    Text: IN portfolio_exec_level_mapping

    Error: PL/SQL: ORA-00904: invalid identifier
    Online: 16
    Text: WHERE portfolio_execp_id = 2851852;

    Error: PL/SQL: statement ignored
    Line: 14
    Text: COLLECT LOOSE v_rec_type

    Error: PLS-00302: component 'FIRST' must be declared
    Online: 19
    Text: LOOP

    Error: PL/SQL: statement ignored
    Online: 19
    Text: LOOP
    ------------------------------------------------------------------------------------------------

    Help PLZ.

    and with a complete code example:

    SQL> CREATE OR REPLACE PROCEDURE sp_test_bulkcollect
      2  IS
      3  TYPE rec_type IS RECORD (
      4  emp_id VARCHAR2(20),
      5  level_id NUMBER
      6  );
      7  TYPE v_rec_type IS TABLE OF rec_type;
      8  v v_rec_type;
      9  BEGIN
     10     SELECT empno, sal
     11     BULK COLLECT INTO v
     12     FROM emp
     13     WHERE empno = 7876;
     14     FOR indx IN v.FIRST..v.LAST
     15     LOOP
     16        dbms_output.put_line('Emp -- '||v(indx).emp_id||' '||v(indx).level_id);
     17     END LOOP;
     18  END;
     19  /
    
    Procedure created.
    
    SQL>
    SQL> show error
    No errors.
    SQL>
    SQL> begin
      2     sp_test_bulkcollect;
      3  end;
      4  /
    Emp -- 7876 1100
    
    PL/SQL procedure successfully completed.
    
  • Creation of XML report using the PL/SQL stored procedure

    Hi friends,

    I'm working on a report xml with the xml source as a PL/SQL stored procedure.

    I mean the fiscal year indicated in the following link to understand the process:

    http://orclapp.blogspot.com/2012/02/developing-xml-publisher-report-using.html

    In the example shown in the link above, I did not understand the following:

    (1) in the following procedure, setting out "retcode" is not used at all.

    What is the importance of this parameter.

    REPORT PROCEDURE (errbuf OUT VARCHAR2, retcode OUT VARCHAR2, p_product_id in NUMBERS)

    (2) after the xml data are prepared and updates 'l_result' variable Clob, what follows

    Loop is executed. I am not able to understand why the following loop is required.

    LOOP

    EXIT WHEN l_length = l_retrieved;

    IF (l_length - l_retrieved) < 32000

    THEN

    SELECT SUBSTR (l_result, l_retrieved + 1) IN l_xmlstr FROM DUAL;

    l_retrieved: = l_length;

    fnd_file.put_line (fnd_file.output, l_xmlstr);

    ON THE OTHER

    SELECT SUBSTR (l_result, l_retrieved + 1, l_offset)

    IN l_xmlstr

    FROM DUAL;

    l_retrieved: = l_retrieved + l_offset.

    fnd_file.put_line (fnd_file.output, l_xmlstr);

    END IF;

    END LOOP;

    (3) in the example it is not explained how the concurrent program gets the xml data?

    I guess that it is written to a file by using the following line of code:

    fnd_file.put_line (fnd_file.output, l_xmlstr);

    I would be grateful if someone can shed some light in my questions above so that I can well understand the process.

    Thanks and greetings

    Hawker

    Hi 32000 in the code is a 'safe' than 32767 available max mesh, loops is intended to get around the entire thing into pieces that can be managed within the limits of the data type.

    BTW; If you are in the following Oracle e-business, you can also use the Oracle reports very simply to create the XML output.

    If you have reports developer all you need to do is put raw sql (create XML without any "Fireworks") in the SQL report and then set reporting in XML format in the definition of program in Oracle e-business.

    Best regards

    Robert.

  • SQL mode not built using the default sql DBTYPE

    When I have updated the SQL text in the view file PV_PERF_SR_VW in the designer of PeopleSoft, it updates the SQL text in the default DBTYPE value in the PSSQLTEXTDEFN table. But when I build the view, it seems to use the text in 2 DBTYPE SQL to generate the view. So the view does not build as we wish. Someone has experience on this?

    When you open the SQL Editor in the App designer to enter your SQL text, there is a drop-down list at the top that you can use to specify the type of DB. It will be by default [Default], but if you expand the list, you can see one or several types of DB appear bold to indicate that SQL database exists. If any SQL database exists for the database you are using, then this prevail all SQL by default when you build the view. If you want to customize the SQL from this point of view, you must first select your database type from the dropdown list and then modify the SQL existing or remove it and then switch back to the default and make your changes.

    In your particular case, DBTYPE 2 would indicate that Oracle-specific SQL exists to PV_PERF_SR_VW.

    Kind regards

    Bob

  • Return lines for pl - sql record type

    We have a requirement to create the function that returns the java application cursor. This slider will have data of type pl - sql record.

    Tried with function in pipeline. I wrote the code below.
    CREATE or replace PACKAGE test_pkg IS 
        TYPE tp_rec IS RECORD(tt_id INTEGER,tt_text VARCHAR2(40)); 
        
        TYPE obj_tp_recs IS TABLE OF tp_rec; 
        TYPE obj_tp_recs1 IS TABLE OF tp_rec; 
     
        FUNCTION test_func RETURN tp_rec; 
        
        function type_out return obj_tp_recs1 PIPELINED; 
        
        PROCEDURE test_type (result out sys_refcursor);
    END; 
    / 
    
    CREATE OR REPLACE PACKAGE BODY OMS.test_pkg IS
        FUNCTION test_func RETURN tp_rec
        AS
           currec tp_rec;
        BEGIN
           currec.tt_id := 1;
           currec.tt_text := 'test1';
        END;
        
         FUNCTION type_out RETURN obj_tp_recs1 PIPELINED
             AS
           currec1 test_pkg.tp_rec;
          begin
                    currec1 := test_pkg.test_func;
                    PIPE ROW(currec1);
                    dbms_output.put_line(currec1.tt_id);
                end;
    
        PROCEDURE test_type (result out sys_refcursor) 
        AS    
        BEGIN
                  OPEN RESULT
                  FOR SELECT * FROM TABLE(test_pkg.type_out());
                  
        END;
    END;
    /
    
    SQL> VARIABLE x REFCURSOR
    
    SQL> exec test_pkg.test_type(:x);
    
    PL/SQL procedure successfully completed.
    
    SQL> print x
    Copy the following code returns no data found exceptional function. How to achieve outcome 1 and test1 on top of code?

    Thanks in advance
    SQL> VARIABLE x REFCURSOR
    SQL> exec test_pkg.test_type(:x);
    
    PL/SQL procedure successfully completed.
    
    SQL> print x
    ERROR:
    ORA-06503: PL/SQL: Function returned without value
    ORA-06512: at "SCOTT.TEST_PKG", line 8
    ORA-06512: at "SCOTT.TEST_PKG", line 14
    
    no rows selected
    

    If you look at test_func body missing return statement. Now:

    SQL> CREATE OR REPLACE PACKAGE BODY test_pkg IS
      2      FUNCTION test_func RETURN tp_rec
      3      AS
      4         currec tp_rec;
      5      BEGIN
      6         currec.tt_id := 1;
      7         currec.tt_text := 'test1';
      8         RETURN currec;
      9      END;
     10
     11       FUNCTION type_out RETURN obj_tp_recs1 PIPELINED
     12       AS
     13         currec1 test_pkg.tp_rec;
     14        begin
     15          currec1 := test_pkg.test_func;
     16          PIPE ROW(currec1);
     17          dbms_output.put_line(currec1.tt_id);
     18          end;
     19
     20      PROCEDURE test_type (result out sys_refcursor)
     21      AS
     22      BEGIN
     23        OPEN RESULT
     24        FOR SELECT * FROM TABLE(test_pkg.type_out());
     25
     26      END;
     27  END;
     28  / 
    
    Package body created.
    
    SQL> exec test_pkg.test_type(:x);
    
    PL/SQL procedure successfully completed.
    
    SQL> print x
    
         TT_ID TT_TEXT
    ---------- ----------------------------------------
             1 test1
    
    SQL> 
    

    SY.

  • How can I use the USRP to record a signal using its two RX ports simultaneously?

    Hello.

    I am trying to record a signal using two antenna cone. The reason that I need two antenna to cover the bandwidth (DC - 6 GHz). a single antenna covers DC - 300 MHz and the other covers 300 MHz to 6 GHz. so I need to use two RX port of USRP at the same time to record the signal. I have two questions:

    1. is this all USRP market capable of covering this frequency range?

    2. is it possible to use the two RX port at the same time to the signals of the records I described? If this is not the case, how can do?

    P.S. I have two NI2920 USRPs and two USRPs N210 in my lab.

    Thanks in advance for your time.

    Sam.

    Hi Sam,

    To answer your first question, the USRPs you can reach the bandwidth you want. There is not a USRP, to my knowledge, that can reach this range in a single device.

    Also note that you can only use RX convened for two different ports at the same time using LabVIEW and the pilot of the USRP. If you want to use the two lines of RX, you will need to run a session with a single line, close the session and then start a different session for your second RX line.

  • Need to check delays in update of 1000 lines using the PL/SQL procedure.

    Hi all

    I'm new to PL/SQL. I need your help to build a procedure that executes the following statement and follows the time of update of 1000 rows. This is to check the performance of the database. I need to print the timestamp of start before the update and end timestamp after update. I need to do for the 1000 lines. The statement that will be used in the procedure is:

    SELECT

    'UPDATE XXAFL_MON_FACTS_F SET TASK_WID =' | NVL (TO_CHAR (TASK_WID), 'NULL') |', EXECUTION_PLAN_WID =' | NVL (TO_CHAR (EXECUTION_PLAN_WID), 'NULL').

    ', DETAILS_WID =' | NVL (TO_CHAR (DETAILS_WID), 'NULL') |', SOURCE_WID =' | NVL (TO_CHAR (SOURCE_WID), 'NULL') |', TARGET_WID = ' | NVL (TO_CHAR (TARGET_WID), 'NULL').

    ', RUN_STATUS_WID =' | NVL (TO_CHAR (RUN_STATUS_WID), 'NULL') |', SEQ_NUM =' | NVL (TO_CHAR (SEQ_NUM), 'NULL') |', NAME = "' | NVL (TO_CHAR (NAME), 'NULL').

    "', NO_POSITION =" ' | NVL (TO_CHAR (INSTANCE_NUM), e ') | " ', INSTANCE_NAME = "' | NVL (TO_CHAR (INSTANCE_NAME), 'NULL').

    "', TYPE_CD =" ' | NVL (TO_CHAR (TYPE_CD), e ') | " ', STATUS_CD = "' | NVL (TO_CHAR (STATUS_CD), e ') | " ', START_TS =' | NVL (TO_CHAR (START_TS), 'NULL').

    ', END_TS =' | NVL (TO_CHAR (END_TS), 'NULL') |', DURATION = ' | NVL (TO_CHAR (DURATION), 'NULL') |', STATUS_DESC = "' | NVL (TO_CHAR (STATUS_DESC), 'NULL').

    "', DBCONN_NAME =" ' | NVL (TO_CHAR (DBCONN_NAME), e ') | " ', SUCESS_ROWS =' | NVL (TO_CHAR (SUCESS_ROWS), 'NULL').

    ', FAILED_ROWS =' | NVL (TO_CHAR (FAILED_ROWS), 'NULL') |', ERROR_CODE = ' | NVL (TO_CHAR (ERROR_CODE), 'NULL') |', NUM_RETRIES =' | NVL (TO_CHAR (NUM_RETRIES), 'NULL').

    ', READ_THRUPUT =' | NVL (TO_CHAR (READ_THRUPUT), 'NULL') |', LAST_UPD = ' | NVL (TO_CHAR (LAST_UPD), 'NULL') |', RUN_STEP_WID = "' | NVL (TO_CHAR (RUN_STEP_WID), 'NULL').

    "', W_INSERT_DT = ' | NVL (TO_CHAR (W_INSERT_DT), 'NULL') |', W_UPDATE_DT = ' | NVL (TO_CHAR (W_UPDATE_DT), 'NULL').

    ', START_DATE_WID =' | NVL (TO_CHAR (START_DATE_WID), 'NULL') |', END_DATE_WID = ' | NVL (TO_CHAR (END_DATE_WID), 'NULL') |', START_TIME =' |

    NVL (TO_CHAR (START_TIME), 'NULL') |', END_TIME =' | NVL (TO_CHAR (END_TIME), 'NULL'). "WHERE INTEGRATION_ID ="' | INTEGRATION_ID | " « ; »  OF XXAFL_MON_FACTS_F;

    The above query creates instructions of update that must be executed 1000 times and the time required to update the 1000 lines should be followed.

    Thanks in advance!

    Code horribly wrong!

    Why this approach?

    Dynamic SQL is almost NEVER needed in PL/SQL. And if you think it's necessary and taking into account what is displayed as being problems here, you have a 99% chance of being wrong.

    This 1% where dynamic SQL is necessary, he will WITH bind variables to create shareable SQL, decrease memory requests, decrease the likelihood of a fragmented shared reel and decrease the burning CPU cycles on hard analysis.

    An example below. Your approach is the 1st. One that is slower than the correct approach to 37 (x_!) ...

    SQL> create table t ( n number );
    
    Table created.
    
    SQL>
    SQL> var ITERATIONS number;
    SQL> exec :ITERATIONS := 100000;
    
    PL/SQL procedure successfully completed.
    
    SQL>
    SQL>
    SQL> TIMING START "INSERTs using Hard Parsing"
    SQL> declare
      2          i      integer;
      3  begin
      4          for i in 1..:ITERATIONS
      5          loop
      6                  execute immediate 'insert into t values ('||i||')';
      7          end loop;
      8          commit;
      9  end;
    10  /
    
    PL/SQL procedure successfully completed.
    
    SQL> TIMING SHOW
    timing for: INSERTs using Hard Parsing
    Elapsed: 00:02:00.33
    SQL>
    SQL> TIMING START "INSERTs using Soft Parsing"
    SQL> declare
      2          i      integer;
      3  begin
      4          for i in 1..:ITERATIONS
      5          loop
      6                  execute immediate 'insert into t values ( :1 )' using i;
      7          end loop;
      8          commit;
      9  end;
    10  /
    
    PL/SQL procedure successfully completed.
    
    SQL> TIMING SHOW
    timing for: INSERTs using Soft Parsing
    Elapsed: 00:00:06.06
    SQL> drop table t;
    
    Table dropped.
    
    SQL> create table t( n number );
    
    Table created.
    
    SQL>
    SQL>
    SQL> TIMING START "INSERTs using a single parse and repeatable statement handle "
    SQL> declare
      2          i      integer;
      3  begin
      4          for i in 1..:ITERATIONS
      5          loop
      6                  insert into t values ( i );
      7          end loop;
      8          commit;
      9  end;
    10  /
    
    PL/SQL procedure successfully completed.
    
    SQL> TIMING SHOW
    timing for: INSERTs using a single parse and repeatable statement handle
    Elapsed: 00:00:04.81
    SQL>
    
  • How to use the pl/sql procedure

    Hi all,

    How to use pl/sql packages and especially in what situations we are pl/sql, which is the cause of the procedure. Please explain with precision using small example.

    Thanks and greetings

    RAM

    I could tell this at a very high level.

    PL/SQL's procedural extension to SQL. SQL (structured query language) has no procedural capacity. They are executed as a stand-alone statement. When you want to generate a process flow with several SQL statement that you need to have a procedural language that could accommodate your SQL. PL/SQL is something similar to Java and Dot Net in this aspect. Said that PL/SQL is Oracle DB. This has some advantages. The most important thing is that when you have your SQL in PL/SQL oracle maintains its reliance on the object. Any database oracle related so you want to build, then you can consider to PL/SQL as the best way to use process flows.

    PL/SQL provides various methods such as the PROCEDURE, FUNCTION and the PACKAGE. The only thing that race stands is in its ability to modularize your code. So, using the package you can create process workflows that is modular and easy to understand.

  • How to import metadata using the Oracle olap connection type

    Hi all

    I'm trying to import metadata from MN,

    I tried selecting the type of connection as oracle olap
    DSN as host: port: sid
    username
    password
    but in URL url field I need to give

    Use OBIEE 11.1.1.7

    in OBIEE 11.1.1.5

    There is no url, after the username and pwd that allows us to give the name of the target, but I don't under stan have to give into the url field.


    Can someone help me on this... :(

    Hi Laszlo,

    Finally fixed it by using the following URL

    http://OBIEESERVERADDRESS:port/biadminservlet/services

  • Separate values for the pre-treatment and results of the comprehensive review (without using the PL/SQL)

    Hi people,
    This year was difficult because it does not clearly justify what I want to achieve. The main reason for me to try this approach is to reduce the time of the performance. I have my program works very well, but since it accesses a view for each student, slows down the performance.

    Purpose of this report: Show all Dates of examination for students, but only to display the results pre and review of the overall assessment on the first line for students.

    Table scripts and INSERT statements:
    create table STUDENT_TB(student_id varchar2(4), last_name varchar2(20), first_name varchar2(20), evaluation_date date);
    create table EXAM_TB(student_id varchar2(4), exam_date date, result number);
    create table EVALUATION_TB(student_id varchar2(4), eval_flag varchar2(1), sampling_date date);
    
    insert into STUDENT_TB values('1001', 'Poppins', 'Mary', to_date('27-SEP-2012', 'DD-MON-YYYY'));
     
    insert into EXAM_TB values('1001', to_date('20-APR-2011', 'DD-MON-YYYY'), 30);
    insert into EXAM_TB values('1001', to_date('20-MAY-2012', 'DD-MON-YYYY'), 39);
    insert into EXAM_TB values('1001', to_date('10-JUL-2012', 'DD-MON-YYYY'), 34);
    insert into EXAM_TB values('1001', to_date('10-SEP-2012', 'DD-MON-YYYY'), 39);
    insert into EXAM_TB values('1001', to_date('01-DEC-2012', 'DD-MON-YYYY'), 82);
     
    insert into evaluation_tb values('1001', null, to_date('22-APR-2011', 'DD-MON-YYYY'));
    insert into evaluation_tb values('1001', 'N', to_date('20-JUL-2012', 'DD-MON-YYYY'));
    insert into EVALUATION_TB values('1001', 'Y', to_date('10-DEC-2012', 'DD-MON-YYYY'));
    Desired output:
    SID     Last Name   First Name   Evaluation Date    Exam Date   Results   Order   Pre Evaluation   Overall Evaluation   Accept?
    ===============================================================================================================================
    1001     Poppins         Mary      27-SEP-12         20-APR-11     30       1           N                       Y            Y
    1001     Poppins         Mary      27-SEP-12         20-MAY-12     39       2
    1001     Poppins         Mary      27-SEP-12         10-JUL-12     34       3
    1001     Poppins         Mary      27-SEP-12         10-SEP-12     39       4
    1001     Poppins         Mary      27-SEP-12         01-DEC-12     82       5
    Business rules:
    The Pre, global assessment and accept it? fields are derived. The area of the pre assessment is derived from the EVALUATION_TBtable. Its the value of eval_flag where sampling_date < = evaluation_date.
    In our example, the pre assessment should be an "n" while the overall assessment must be a 'Y '. The priority is Y-> N-> Null. The Accept flag is set to a 'Y' If a meadow at overall results past of N to Y or a NULL of Y value.

    I have to return all the lines for the student that show the results of the reviews SQL is the following:
    I need to join the view EVALUATION_TB. Simply join them of course would be a resulting vector product in 15 files that I don't want. I tried online (subqueries) but I failed again. Any help would be great!
    I created the column ord_num to maybe help using only this folder to display the results of the assessment.
    select x.student_id, x.last_name, x.first_name, x.evaluation_date,
           m.exam_date, m.result,
           dense_rank() over (partition by x.student_id order by m.exam_date) ord_num
    from
    (
      select  s.student_id, s.last_name, s.first_name, s.evaluation_date
      from    student_tb s
    ) x, exam_tb m
    where x.student_id = m.student_id (+);
    
    SID     Last Name   First Name   Evaluation Date    Exam Date   Results   Order
    ===============================================================================
    
    1001     Poppins     Mary     27-SEP-12     20-APR-11     30     1
    1001     Poppins     Mary     27-SEP-12     20-MAY-12     39     2
    1001     Poppins     Mary     27-SEP-12     10-JUL-12     34     3
    1001     Poppins     Mary     27-SEP-12     10-SEP-12     39     4
    1001     Poppins     Mary     27-SEP-12     01-DEC-12     82     5
    Thank you!

    Published by: Roxyrollers on March 14, 2013 11:37

    Published by: Roxyrollers on March 14, 2013 11:38

    Published by: Roxyrollers on March 14, 2013 12:27

    Published by: Roxyrollers on March 15, 2013 13:43

    Hi Roxyrollers,

    Please check your insert statements before posting. They have syntax errors.

    The following query is to give you the desired result:

    with pre_eval as
    (
       select e.student_id
            , max(e.eval_flag) keep(dense_rank last order by e.sampling_date) eval_flag
         from evaluation_tb e join student_tb s
              on e.student_id=s.student_id
                 and e.sampling_date <= s.evaluation_date
       group by e.student_id
    )
    ,all_eval as
    (
       select e.student_id
            , max(e.eval_flag) keep(dense_rank last order by e.sampling_date) eval_flag
         from evaluation_tb e join student_tb s
              on e.student_id=s.student_id
       group by e.student_id
    )
    , data_with_rank AS
    (
       select s.student_id, s.last_name, s.first_name, s.evaluation_date
            , m.exam_date, m.result
            , dense_rank() over (partition by s.student_id order by m.exam_date) ord_num
         from student_tb s
              left outer join exam_tb m
              on (s.student_id = m.student_id)
    )
    select s.student_id, s.last_name, s.first_name, s.evaluation_date
         , s.exam_date, s.result
         , e.eval_flag as pre_eval
         , a.eval_flag as overall_eval
         , case when a.eval_flag='Y' and e.eval_flag!='Y' then 'Y' end accept
      from data_with_rank s
           left outer join pre_eval e
              on (s.student_id = e.student_id and s.ord_num=1)
           left outer join all_eval a
              on (s.student_id = a.student_id and s.ord_num=1)
    order by s.student_id, s.exam_date;
    
    STUDENT_ID LAST_NAME            FIRST_NAME           EVALUATION_DATE EXAM_DATE     RESULT PRE_EVAL OVERALL_EVAL ACCEPT
    ---------- -------------------- -------------------- --------------- --------- ---------- -------- ------------ ------
    1001       Poppins              Mary                 27-SEP-12       20-APR-11         30 N        Y            Y
    1001       Poppins              Mary                 27-SEP-12       20-MAY-12         39
    1001       Poppins              Mary                 27-SEP-12       10-JUL-12         34
    1001       Poppins              Mary                 27-SEP-12       10-SEP-12         39
    1001       Poppins              Mary                 27-SEP-12       01-DEC-12         82                                                                          
    

    However, is not clear to me why the assessment are related only to the first line in the query.
    The evaluation_tb table is in fact related to student_id and I expect to be connected all lines.

    I've actually linked subqueries pre_eval and all_eval only in line with rank = 1 but I don't understand if that's correct according to business requirements.

    Kind regards.
    Al

    Published by: Alberto Faenza on 14 March 2013 20:29
    ORDER BY added, deleted ord_num output

Maybe you are looking for