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.

Tags: Database

Similar Questions

  • 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.
    

    ?

  • How to pass the line for the delimited file type?

    Hi, I want to ask you how to jump (example: the line of the first two) for delimited file type?
    Thank you...


    Here's my script
    Int NY_Skip06Center [strField, strRecord]
    '------------------------------------------------------------------
    "Script to Import DataPump FDM:
    "Created by: FDM_Admin"
    "Creation date: 28/02/2006.
    '------------------------------------------------------------------
    Dim strEntity
    'Check the first two characters of the entity.
    StrEntity = 1 to 6
    "Line break
    Res.PblnSKip = True
    Next StrEntity
    End if
    End Function

    But he returns this error when importing
    Error: An error occurred importing the file.
    Detail: Object Variable or With block variable not set

    Anyone know what is the problem

    Published by: user649207 on March 19, 2010 02:15

    Published by: user649207 on March 19, 2010 03:04

    You're overloading it.

    Your script can be this:

    Function SkipBlankAcc (strField, strRecord)

    If Trim (strField) = "" then
    Res.pblnSkip = True
    End if

    SkipBlankAcc = strField

    End Function

    If it works for you, please mark the answer as being correct others to take advantage.

  • You have no lines for the SQL query to select

    Dear Sir.

    I don't want to choose these lines in the second query, please guide me how to do.

    Request-> 1

    (SELECT ID_NO, ATTND_DATE
        FROM ATTND_REGISTER 
        WHERE ATTND_DATE BETWEEN :FD AND :TD
        ORDER BY ID_NO, ATTND_DATE
    )AT
    

    A query result.

    ID_NOATTND_DATE
    E1FEBRUARY 1, 14
    E1FEBRUARY 2, 14
    E13 FEBRUARY 14
    E14 FEBRUARY 14
    E1FEBRUARY 5, 14
    E1FEBRUARY 6, 14
    E1FEBRUARY 7, 14
    E1FEBRUARY 8, 14
    E1FEBRUARY 9, 14
    E110 FEBRUARY 14
    E1FEBRUARY 11, 14
    E1FEBRUARY 12, 14
    E1FEBRUARY 13, 14
    E114 FEBRUARY 14
    E115 FEBRUARY 14
    E116 FEBRUARY 14
    E117 FEBRUARY 14
    E118 FEBRUARY 14
    E119 FEBRUARY 14
    E120 FEBRUARY 14
    E4FEBRUARY 1, 14
    E4FEBRUARY 2, 14
    E43 FEBRUARY 14
    E44 FEBRUARY 14
    E4FEBRUARY 5, 14

    Request-> 2

    : VALUE OF THE VARIABLE FD = 1 FEBRUARY 14

    : VALUE OF THE VARIABLE TD = FEBRUARY 28, 14 '

    SELECT A.ID_NO,B.DATES,A.EMP_NAME, A.DESG_NAME
    FROM
      (
        SELECT  ROWNUM - 1 + TO_DATE(:FD, 'DD/MM/RR') DATES
        FROM ALL_OBJECTS
        WHERE ROWNUM < TO_DATE(:TD, 'DD/MM/RR') - TO_DATE(:FD, 'DD/MM/RR') + 2
      )B,
    
    
      (
        SELECT ID_NO, INITCAP(FL_NAME) AS EMP_NAME, INITCAP(UBN.DESG_NAME(DESG_ID)) AS DESG_NAME
        FROM PERSONAL
        WHERE (STATUS = 'A')
        AND (COMPANY_CODE = :COMPANY_CODE)---COMPANY CODE=6
        AND (ID_NO = :ID_NO OR :ID_NO IS NULL)
      )A
    ORDER BY A.ID_NO,B.DATES;
    


    Solved

    I changed in the second query with using the first query.

    in Where Clause

    WHERE B.DATES | A.ID_NO NOT IN (SELECT ATTND_DATE |) NBI ID_NO. ATTND_REGISTER

    WHERE ATTND_DATE BETWEEN: FD AND: TD)

    Thank you Allah (SWT).

  • PLS-00362: Invalid cursor return type; 'NUMBER' must be a record type

    Hello

    Having a little trouble with the following code example provided to http://www.dba-oracle.com/plsql/t_plsql_cursor_variables.htm:
      1  DECLARE
      2    TYPE t_ref_cursor IS REF CURSOR RETURN NUMBER;
      3    c_cursor  t_ref_cursor;
      4    l_row   NUMBER;
      5  BEGIN
      6    DBMS_OUTPUT.put_line('Strongly typed REF CURSOR using SCALAR type. Expect an error!');
      7    OPEN c_cursor FOR
      8      SELECT COUNT(*) cnt
      9      FROM   cursor_variable_test;
     10    LOOP
     11      FETCH c_cursor
     12      INTO  l_row;
     13      EXIT WHEN c_cursor%NOTFOUND;
     14      DBMS_OUTPUT.put_line(l_row);
     15    END LOOP;
     16    CLOSE c_cursor;
     17* END;
     18  /
      TYPE t_ref_cursor IS REF CURSOR RETURN NUMBER;
                           *
    ERROR at line 2:
    ORA-06550: line 2, column 24:
    PLS-00362: invalid cursor return type; 'NUMBER' must be a record type
    ORA-06550: line 2, column 3:
    PL/SQL: Item ignored
    In the code above, SELECT COUNT (*)... returns a NUMBER. I know it's an aggregation function, but it returns a single value.
    Why can't return a value in a column of a row in a NUMBER?
    How can I change the SQL code so that I can do this?

    Furthermore, I wonder about the use of FETCH with a count (*)... FETCH is supposed to fetch the next row... How it works when you select an aggregate as County?

    Thank you very much
    Jason

    >
    TYPE t_ref_cursor IS REF CURSOR RETURN NUMBER;
    *
    ERROR on line 2:
    ORA-06550: line 2, column 24:
    PLS-00362: Invalid cursor return type; 'NUMBER' must be a record type
    ORA-06550: line 2, column 3:
    PL/SQL: Ignored Element

    In the code above, SELECT COUNT (*)... returns a NUMBER. I know it's an aggregation function, but it returns a single value.
    Why can't return a value in a column of a row in a NUMBER?
    How can I change the SQL code so that I can do this?
    >
    The exception is in line 2: your cursor statement. And the answer is in the text that you access
    >
    The return value of a strongly typed REF CURSOR must be a folder that can be defined using % TYPE % ROWTYPE attributes or record structure.
    >
    You said the CURSOR to return a NUMBER. And as the text says, he must be a 'record '.
    >
    Furthermore, I wonder about the use of FETCH with a count (*)... FETCH is supposed to fetch the next row... How it works when you select an aggregate as County?
    >
    As you said already FETCH retrieves the next line, if any. A query is a request is a request. It returns a result set. A query that uses aggregates returns a result set. A query that does not aggregate returns a result set.

    Your simple COUNT (*) SELECT query returns a result set that consists of a LINE and a line a ONE COLUMN of type NUMBER. Although there is only one column in the result set, what is returned is a RECORD or a LINE. That's why you have to report your data cursor return type a document using the % ROWTYPE or % TYPE attributes or a record structure.

  • Error creating service with record type as a return type

    Hi, I tried the following code to get the nth highest sal using the service and the record type.
    CREATE OR REPLACE PACKAGE pack_rec_cur AS
    TYPE rec_type IS RECORD (
     name EMP.ename%TYPE,
     sal EMP.sal%TYPE);
      END;
    The lot above is created
    CREATE OR REPLACE 
      FUNCTION fun_rec_cur(n INT) RETURN pack_rec_cur.rec_type AS
       rec pack_rec_cur.rec_type;
        CURSOR cur_rec IS
          SELECT ename,sal
            FROM emp
             WHERE sal is not null 
              ORDER BY DESC;
    BEGIN
     OPEN cur_rec;
      FOR i IN 1..n LOOP
       FETCH cur_rec into rec;
       EXIT WHEN cur_rec%NOTFOUND;
      END LOOP;
     CLOSE cur_rec;
     RETURN rec;
    END;   
    The above function is errors
    LINE/COL ERROR
    -------- ---------------------------------------
    4/7      PL/SQL: SQL Statement ignored
    7/16     PL/SQL: ORA-00936: missing expression
    SQL> 
    Could you please correct me where I am wrong

    Thank you.

    By clauase missing column name in the order. Is it ename desc?

    CREATE OR REPLACE
      FUNCTION fun_rec_cur(n INT) RETURN pack_rec_cur.rec_type AS
       rec pack_rec_cur.rec_type;
        CURSOR cur_rec IS
          SELECT ename,sal
            FROM emp
             WHERE sal is not null
              ORDER BY ENAME DESC; ---added ename
    BEGIN
     OPEN cur_rec;
      FOR i IN 1..n LOOP
       FETCH cur_rec into rec;
       EXIT WHEN cur_rec%NOTFOUND;
      END LOOP;
     CLOSE cur_rec;
     RETURN rec;
    END;   
    
    ------------
    -OUTPUT
    -----------
    
    SQL> SET SERVEROUT ON
    SQL>
    SQL> DECLARE
      2     rec            pack_rec_cur.rec_type;
      3  BEGIN
      4     rec         := fun_rec_cur (6); --you get the 6th record in order of ename desc
      5     DBMS_OUTPUT.put_line ('ename::' || rec.NAME || '  sal ::' || rec.sal);
      6  END;
      7  /
    ename::MARTIN  sal ::1250
    
    PL/SQL procedure successfully completed.
    
    SQL> 
    
  • Return the record type


    Hello

    I have a requirement of the company, where I need to return a record type (OUT parameter) for environment call based on the given input value.

    Suppose that if the value is correct and corresponding record is found in the table then the return values for this key entry. If matching record is found, then return the exception to the calling environment.

    To do this, I created an example of test table and populated records.

    create table plch_test(dept_id number,dept_name varchar2(50),cost_centre number);
    insert into plch_test values(10,'SALES',1010);
    insert into plch_test values(20,'FINANCE',2010);
    insert into plch_test values(30,'MKTG',3010);
    
     
    SQL> select * from plch_test;
       DEPT_ID DEPT_NAME                                          COST_CENTRE
    ---------- -------------------------------------------------- -----------
            10 SALES                                                     1010
            20 FINANCE                                                   2010
            30 MKTG                                                      3010
    
     
     
    

    I wrote a simple block and gave a valid key dept_id (10 in this case) to display costcentre for this dept_id and dept_name I said tow types of records, one for valid record and another exception

    
    

    SQL> DECLARE 
      2  TYPE rec_dept IS RECORD(dept_name varchar2(50),cc number);
      3  l_rec_dept rec_dept;
      4  TYPE rec_exception IS RECORD(err_code number,error_message varchar2(300));
      5  l_rec_exception rec_exception;
      6  BEGIN
      7  SELECT dept_name,cost_centre
      8  INTO l_rec_dept
      9  FROM plch_test
     10  where dept_id=10;
     11  dbms_output.put_line('DEPT_NAME'||' '||l_rec_dept.dept_name||' '||'COSTCENTRE'||' '||l_rec_dept.cc);
     12  EXCEPTION WHEN NO_DATA_FOUND THEN
     13  l_rec_exception.err_code:=sqlcode;
     14  l_rec_exception.error_message:=sqlerrm;
     15  dbms_output.put_line(l_rec_exception.err_code||' '||l_rec_exception.error_message);
     16  END;
     17  .
    SQL> /
    DEPT_NAME SALES COSTCENTRE 1010
    PL/SQL procedure successfully completed.
    SQL> 
    
     
    

    Now for invalid dept_id and expose the message by using exception record type I stated.

    SQL> ed
    Wrote file afiedt.buf
      1  DECLARE
      2  TYPE rec_dept IS RECORD(dept_name varchar2(50),cc number);
      3  l_rec_dept rec_dept;
      4  TYPE rec_exception IS RECORD(err_code number,error_message varchar2(300));
      5  l_rec_exception rec_exception;
      6  BEGIN
      7  SELECT dept_name,cost_centre
      8  INTO l_rec_dept
      9  FROM plch_test
     10  where dept_id=40; --Invalid --data is not present
     11  dbms_output.put_line('DEPT_NAME'||' '||l_rec_dept.dept_name||' '||'COSTCENTRE'||' '||l_rec_dept.cc);
     12  EXCEPTION WHEN NO_DATA_FOUND THEN
     13  l_rec_exception.err_code:=sqlcode;
     14  l_rec_exception.error_message:=sqlerrm;
     15  dbms_output.put_line(l_rec_exception.err_code||' '||l_rec_exception.error_message);
     16* END;
    SQL> /
    100 ORA-01403: no data found
    PL/SQL procedure successfully completed.
    
    

    Now as you can see I need to include this point in a procedure with an input parameter and output must be a record types which will return

    rec_dept if it becomes a key input valid or an exception if she meets a key not valid.

    
    CREATE PROCEDURE test_prc IS(p_in_dept_id IN plch_test.dept_id,p_output ??????
    DECLARE 
    TYPE rec_dept IS RECORD(dept_name varchar2(50),cc number);
    l_rec_dept rec_dept;
    TYPE rec_exception IS RECORD(err_code number,error_message varchar2(300));
    l_rec_exception rec_exception;
    BEGIN
    BEGIN
    SELECT dept_name,cost_centre
    INTO l_rec_dept
    FROM plch_test
    where dept_id=p_ind_dept_id;
    RETURN l_rec_dept;
    EXCEPTION WHEN NO_DATA_FOUND THEN
    l_rec_exception.err_code:=sqlcode;
    l_rec_exception.error_message:=sqlerrm;
    RETURN l_rec_exception;
    END;
    dbms_output.put_line('DEPT_NAME'||' '||l_rec_dept.dept_name||' '||'COSTCENTRE'||' '||l_rec_dept.cc);
    END;
    

    Hope that the explanation above help in imposes the requirement

    Kind regards

    Claudy kotekal

    Return a record which can mean two things is complicated; I'm not an experienced myself pl/sql developer, but this looks like a craft.

    The idea of exceptions under Sir Thomas of Kyte, is that any treatment must be stopped; You should RAISE an exception to the appellant so that he can figure out what to do with it.  What you are saying, this is an exception, but is not a little, cos it's okay, I'll just keep but I will go back to the appellant in any way, but the appellant shall include this registration type is - would it be a record representing a row of the table, or it might be an exception... yuck.

    (a) is it really an exception

    (b) what do you do with it? You he could log into a table, you could write to a file, you can display an error message on the screen

    But really, it's weird to want to pass an exception as return value.

    These are all considerations of design, not really anything to do with the pl/sql language in itself.

    But hard, if you send a record type a successful being found, registration-based stick to it and don't use it to return a record; do not try to do double duty with her flipping something else.  Just save the message put in a table, or print it to the console, or what you want to do with; but as I said, the most important decision is, is this really an exception. And is based on the data model and the expectations of cleanliness of the data etc.

    Think about how you call built-in functions. If you send garbage to a built-in function it does not return successfully, leaving you to figure out whether he succeeded or not by inspecting the return value; It goes kaboom, something bad happened.  That's what your function should do if something bad happens, that is to say, if you get an exception, it should probably go kaboom.

  • How to use the record type as a parameter IN PL/SQL procedure or package

    Hi people,

    I need help on the record as the OUT parameter type. I am able to get out a single line as a parameter, but not getting do not idea how to get a multi ranks as output parameter.

    I have the code that works very well for a single line. Please see CODE1.

    But when I try to get several lines, I'm failing to do. Please see the CODE2. I get the error of compilation as


    Error report:

    ORA-06550: line 11, column 35:

    PLS-00487: Invalid reference to the variable "P_NAME.

    ORA-06550: line 11, column 1:

    PL/SQL: Statement ignored

    06550 00000 - "line %s, column % s:\n%s".

    * Cause: Usually a PL/SQL compilation error.

    Any help or a sample execution of script would be really useful.

    Thanks in advance.

    YZ

    --------------------------CODE1------------------------------------------

    -------------------------Package Spec-------------------------------

    CREATE OR REPLACE

    PACKAGE xx_sample_pkg as

    --

    Xx_sample_table_rectype RECORD TYPE IS

    (p_name varchar2 (40))

    number of p_emp_id

    );

    PROCEDURE xx_sample_prc (xx_sample_rec1, OUT xx_sample_table_rectype);

    END xx_sample_pkg;

    ------------------------------Package Body------------------------

    create or replace

    PACKAGE xx_sample_pkg AS BODY

    --

    PROCEDURE xx_sample_prc (xx_sample_rec1 OUT xx_sample_table_rectype) IS

    BEGIN

    SELECT ename, empno

    IN xx_sample_rec1

    FROM scott.emp

    WHERE ename = 'SMITH ';.

    END xx_sample_prc;

    END xx_sample_pkg;

    -------------------------------------------Execute----------------------

    DECLARE

    l_rec_type xx_sample_pkg.xx_sample_table_rectype;

    BEGIN

    dbms_output.put_line ('xx_sample_prc appeal');

    xx_sample_pkg.xx_sample_prc (l_rec_type);

    dbms_output.put_line ('YZ' | l_rec_type.p_name |') '|| l_rec_type.p_emp_id);

    END;

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

    -------------------------CODE2-------------------------------------------

    -------------------------Package Spec-------------------------------

    CREATE OR REPLACE

    PACKAGE xx_sample_pkg as

    --

    Xx_sample_table_rectype RECORD TYPE IS

    (p_name varchar2 (40))

    number of p_emp_id

    );

    PROCEDURE xx_sample_prc (xx_sample_rec1, OUT xx_sample_table_rectype);

    END xx_sample_pkg;

    ------------------------------Package Body------------------------

    create or replace

    PACKAGE xx_sample_pkg AS BODY

    --

    PROCEDURE xx_sample_prc (xx_sample_rec1 OUT xx_sample_table_rectype) IS

    BEGIN

    SELECT ename, empno

    IN xx_sample_rec1

    FROM scott.emp;

    END xx_sample_prc;

    END xx_sample_pkg;

    -------------------------------------------Execute----------------------

    DECLARE

    l_rec_type xx_sample_pkg.xx_sample_table_rectype;

    BEGIN

    dbms_output.put_line ('xx_sample_prc appeal');

    xx_sample_pkg.xx_sample_prc (l_rec_type);

    for l_rec in 1.l_rec_type.p_name.count

    loop

    dbms_output.put_line ('YZ' | l_rec_type.p_name (l_rec) |) » '|| l_rec_type.p_emp_id (l_rec));

    end loop;

    end;

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

    bb8c573a-6ca3-4d7c-90ed-e55c2df67201 wrote:

    But now, my question would be why the record type could not be used? My understanding is missing some concept between use of type type array collection record vs. Please specify.

    Do not confuse the folder with the collection.

    SY.

  • Dynamic SQL with in bulk in the record type

    Oracle 10.2 g

    I received this Tom

    [http://asktom.oracle.com/pls/apex/f?p=100:11:0:NO:]

    I'm able to do this without dynamic SQL, but my requirement is to do it in dynamic SQL
     create table t1 ( x int, y int );
    
     insert into t1 select rownum, rownum+1 from all_users where rownum <= 5;
    
     create table t2 ( x int, y int, z int );
    
     declare
                type array is table of t1%rowtype;
                l_data array;
        begin
                select * bulk collect into l_data from t1;
      
                forall i in 1 .. l_data.count
                
                       execute immediate 'insert into (select x, y from t2) values :x' using l_data(i);
        end;
     
    Error at line 1
    ORA-06550: line 9, column 90:
    PLS-00457: expressions have to be of SQL types
    ORA-06550: line 9, column 20:
    PL/SQL: Statement ignored
    There is a work around in 11g, but can we do something in 10g?



    Thank you
    HESH.

    HESH wrote:

    but following does not.

    declare
    type array is table of t1%rowtype;
    l_data array;
    begin
    select * bulk collect into l_data from t1;
    
    forall i in 1 .. l_data.count
    
    execute immediate 'insert into (select x, y from t2) values :x' using l_data(i);
    end;
    

    I want just a dynamic SQL code for the insert with FORALL statement would adopt as well as collections.

    Doesn't make much sense.

    Extract you the data from the SQL engine in the table of the record type. If the output data that cursor SQL must be read in the SQL engine and copied into the memory of PL/SQL engine.

    Then, you send that VERY SAME DATA back to the SQL engine to be used by a SQL insert cursor.

    Where is the logic behind the extraction of data from SQL in a PL/SQL table structure and then push this same structure table on the SQL engine database? What is the purpose to send data on a detour of underperforming and non-scalale through the PL/SQL engine?

    You have any justification (technical or functional wise) to back up this absurd approach?

    Why this can be achieved using a single SQL cursor that does both the choice (extraction) and (in bulk) insertion - using the plain old INSERT... SELECT structure?

    And if the insert is variable, then what? Create a dynamic INSERT... SELECT cursor and execute it (using bind values). This simple... Right?

  • How to create a type of record and a pl/sql table of this record type in the database

    Hello
    I want to create a record type, and then I want to create a PL/SQL table in the oracle 9i database.
    I did block PL/SQL.
    But when I'm doing it in the database it throws me a few errors.
    Could you please tell me how can I do?

    Concerning

    user576726 wrote:
    Hello
    I want to create a record type, and then I want to create a PL/SQL table in the oracle 9i database.
    I did block PL/SQL.
    But when I'm doing it in the database it throws me a few errors.
    Could you please tell me how can I do?

    Concerning

    RECORD type is only supported in PL/SQL for SQL, you must use the OBJECT type.

  • Convert or map Typedonnees decimal Transact-SQL for Oracle Number data type?

    MSSQL 2005
    Oracle 10.2 g

    In a MSSQL table, I have a column with the data type set on (decimal (1.0), null) with the values of line-1. (695 lines in total)

    In the Oracle table, the proposed mapped column is a number data type. When I import data, I received 695 errors with the message "invalid value for the field. How to properly convert or map Decimal (MSSQL) Transact-SQL for Oracle Number data type for a negative value?

    Thank you.

    How do you load data into Oracle? What tool or programming language you are using? Can you post something cause what you stated in your post should work, but there may be some ODBC, or other type of conversion factors to be taken into account.

     > create table t1 (field1  number(1,0));
    
    Table created.
    
     > insert into t1 values (-1);
    
    1 row created.
    
    UT1 > select * from t1;
    
        FIELD1
    ----------
            -1
    

    HTH - Mark D Powell.

  • How to divide a single line (all lines) for the use of a few sql

    I have table

    Select * from une_table;

    name_a
    date_a
    name_b

    Date_B

    Sunday01.01.2015Monday02.01.2015
    Tuesday03.01.2015Wednesday04.01.2015

    How to divide this table in all lines after using sql:

    name
    Date
    Sunday01.01.2015
    Monday02.01.2015
    Tuesday03.01.2015
    Wednesday04.01.2015

    Thanks for the replies.

    Trajon,

    You don't have a table. You have a store of garbage. There is a repeating group in your 'table' and column name_a etc is unnecessary, because you can derive the day of the week from your date by a to_char function.

    You can find it in your documentation online.

    Knowing that you can get the ordinal number of a date using to_char, what have you tried to do it yourself?

    Your answer is probably: NOTHING.

    First try to solve it yourself and if you post something here, make sure that this forum is not to throw up, because your code that is terribly bad.

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

    Sybrand Bakker

    Senior Oracle DBA

  • Limit the "Record Type" options in the section search for presentation of the action bar

    Is it possible to limit the options of 'Record Type' in the 'Search' section in the disposition of the action bar for users specific role.

    Thank you!

    Mahesh, if you uncheck the box to go to step 2 of the role that you would restrict access to these types of records in the section of the application and research in the action bar.

  • Solution campus 9.0: security at the level of the line - duration of the recording of a search process

    People,

    Hello. I implement 9.0 Solution on a University Campus. I faced a problem as below:

    Navigator:
    Campus community
    -Personal Information (student)
    -Add/update a person > Search EMPLID

    I can enter new information of a person in the system and save successfully. All the information of the people returned to the level of the SQL database > successfully. But in the browser, click on "Search", it returns "no corresponding value found.

    I followed the tutorial http://peoplesoftconcept.blogspot.com/2014/03/row-level-security-views-as-search.html review of research PEOPLE_SRCH (view) for the SCC_BIO_DEMO component. GBL step by step as below:

    Step 1:

    Check them that whitelists has been entrusted to the PS of the user on the user profile page below:

    Navigator PeopleTools > Security > (PS) user profile > general page

    There are 4 predefined whitelists:
    Browser home page: HCSPNAVHP
    Profile of the process: HCSPPRFL
    Elementary school: HCPPALL
    Rank of security: HCDPALL

    Step 2:
    Check security game and the Type of security access to the list of security permissions line HCDPALL as below:

    Navigator SetUp HRMS > Security > security level line Core > secure by the permissions list

    Whitelist: HCDPALL
    Security set: PPLOI (Description: unemployed people)
    Type of security access: 009
    Key 1: 00000-00007, 00008, 00009, 00010

    SQL > Select CLASSID, SCRTY_SET_CD, SCRTY_TYPE_CD, SCRTY_KEY1 from USER.PS_SJT_CLASS_ALL where CLASSID = "HCDPALL";

    His output: 42 selected lines. Type of security access 00009 has 5 ranks as below:

    HCDPALL PPLPOI 00000-00009
    HCDPALL PPLPOI 00009 00007
    HCDPALL PPLPOI 00009-00008
    HCDPALL PPLPOI 00009 00009
    HCDPALL PPLPOI 00009 00010

    Step 3:
    Check if these types of security and the security of key1 access access EMPLID.

    SQL > select EMPLID in user.PS_SJT_PERSON where SCRTY_TYPE_CD = '009 ' AND SCRTY_KEY1 = ' 00000';

    Its output:

    0075

    0076

    SQL > select EMPLID in user.PS_SJT_PERSON where SCRTY_TYPE_CD = '009 ' AND SCRTY_KEY1 = ' 00009';

    Its output:

    0064
    0065
    0066
    ...

    There is no selected line for SCRTY_KEY1 '00007', '00008', "00010".

    The above output means Permission list HCDPALL, set of security PPLPOI security type 00009 and security access key1 00000, 00009 to have access to all of the EMPLIDs. Thus, the outputs above must return in the browser browser:
    Campus community
    -Personal Information (student)
    -Add/update a person > Search "EMPLID.

    The problem is that the output above does not return in the browser browser:
    Campus community
    -Personal Information (student)
    -Add/update a person > Search "EMPLID.

    I see no error to find record PEOPLE_SRCH (view) running the process. I can't understand why the output does not return in the browser "Find" EMPLID.

    My question is:

    Is that what you would you please run the 3 steps above in your machine and to understand why the output does not return in the browser "Find" EMPLID?


    Thanks in advance.


    People,

    Hello. The problem is solved by myself.

    The thing is that we can get the information of a person into the system and return it as a person. But if we want to return as a student, the person needs to have registration and registration information. If the person is not admitted or not save you no matter what class, may not be back as a student.

    Thank you.

  • ENQ: TX - conflict in line for the foreign key lock

    Hi all

    My DB is 11.2 exadata machine.

    I've got to get a case and don't know how to explain it.

    session 1:

    create the parent table)
    ID number primary key);
    create the child table)
    parent references ID number,
    name varchar2 (20));
    insert into values parent (3);

    session 2:
    Insert children values (3, 'aa');

    Session 2 crashes.

    I'm curious to know how oracle knows that 3 in the parent table can be inserted? Otherwise, why not oracle comes throwing ORA - 02291:parent key is not immediately that I have ' insert into child values (3, 'aa');

    Best regards
    Leon

    user6806750 wrote:
    >
    So I agree with the OP: the second operation should immediately receive the error 'parent does not exist', instead of block.
    >

    How about this scenario
    Session 1:

    1. insert into parent(id) values (3);
    2. commit;
    3. delete from parent where id = 3
    

    Session 2:

    1. insert into child values (3,'aa');
    

    What a result for the session 2 you expect in this case?

    Let me repeat a sentence of my previous post:
    Theoretically, the general rule is that account required to a SQL statement (whose key foreign is just one particular case) two different operations should only be serialized when both transactions run a kind of DML statement that could be contrary to the assertion.

    Now give me a scenario where two operations in effect running a kind of DML which could be contrary to the assertion of FK:
    -session 1 deletes a parent, which could be contrary to the assertion of FK because there may be child-lines 'under' parent.
    -session 2 inserts a child, which could be contrary to the assertion of FK because there could be a mother line for that child.

    ERGO: sessions 1 and 2 in your scenario above must be serialized.

    Still once, this was not the case in the scenario of the OP: FK assertiveness could never be breached by what session 1 (insert a new parent).

    >
    I don't see what that has to do with "modes of locking for insert, update, delete statements" (what do you mean by there btw?)
    >
    Thus,.
    Oracle of the second session always will go, lock in exclusive mode the entry created in the child table and then try to check for the presence of record in the parent table by reading it in shared mode (why reading is in shared mode must be clear from the scenario described above). Because the parent record is locked in exclusive mode, it cannot hold a shared lock, so he waits. So, if we need a different result if the first session of the insertions and deletions a record, Oracle, stumbled on the lock, you need to know what type of operation has led to the blocking.
    Something like that...

    The problem with the implementation of the Oracle of the assertion of FK is it locks data to serialize an assertion of the FK validation.
    Theoretically, this is the wrong approach. When dealing with simultaneous transactions and validation of constraints in several rows, it should return a predicate to first lock and then read the other rows (without lock somehow) to validate the assertion. Scientific research for this return began in the 1970s: http://dl.acm.org/citation.cfm?id=360369

Maybe you are looking for

  • LabVIEW 2011 SP1

    I was wondering if anyone knows if\when Labview 2011 the service pack will be available?  Have just got the CD for 2011 of it Department, but realizing that they often release a service pack in February in order to don't want to lose a day to install

  • How to uninstall Bing toolbar?

    How do I uninstall the Bing toolbar and how can I avoid being spammed with him again? Thank you

  • Printer hp deskjet 1220C to windows XP SP3 drivers

    Printer hp deskjet 1220C to windows XP SP3 drivers, exist?

  • FORGET SCREENLOCK PIN and I can't reset

    that do I do to reset the phone or pin code because evrywere watching it to be reset but when I do it stand you need to unlock your phone and I can't do it because I forgot my pin code

  • Cannot access account livemail

    Today, after installing a windows update, I can not on my account of livemail.  I tried to re set up, but I don't know the reception and sending of accounts for y7mail