AND / OR truth in SQL table

Why null is introduced in the AND and OR truth table? When a statement/framework of a statement returns a null value?

|AND               |True          |False             |NULL??        |
|True               |True          |False             |Null             |
|False              |False          |False             |False           |
|Null                |Null             |Null               |Null             |
is it introduced in and/or for the containing null until truth table?
select employee_id,last_name,job_id,salary
from employees
wheere salary >= 1000

And job_id like '%man%';

how the statement after the where cluz can return null value??
Published by: Stephanie Center on August 14, 2009 11:36

Solomon Yakobson says:
Well, NULL means value is unknown.

Distinguishing on this specific statement (get all semantic on you ;-)) - NULL is not a value in itself.) That's why we can use mathematical operators on it, because there is no value to operate on. And that's what means NULL. No unknown value, but no value.

Think about a column in Oracle as having two possible States. A value or no value.

NULL is therefore a variable or a column "+ State +" descriptor and not some kind of value that is assigned to it.

Tags: Database

Similar Questions

  • Dimension to build using the SQL table and process to populate the SQL table

    I have a dimension in a cube that is manually* built by one of our power users. Now, I have to get all the information of members of this dimension in a SQL table (example: with columns... Level0, level0property, level1, level1property etc...) to use this table in the STUDIO for the responsibility of the Member.

    Is there any easy process to do this? Currently I am building each line manually in the SQL table and there are 1100 + members in that manually built dimension. Please advice.

    Look at the outline of applied olap Extractor is a free utility

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

  • collect two pl/sql table dimensions and in bulk

    Hi, I want to create a pl/sql table of two-dimensional characters. I would like to know if I can use in bulk accumulate in this case in a select statement
    can you give us examples?

    t_collection('flower) ('water') should return a value in the table after that I have bulk collect two-dimensional pl/sql table

    elmasduro wrote:
    Hi, I want to create a pl/sql table of two-dimensional characters. I would like to know if I can use in bulk accumulate in this case in a select statement
    can you give us examples?

    t_collection('flower) ('water') should return a value in the table after that I have bulk collect two-dimensional pl/sql table

    I don't think that COLLECT in BULK supports complex tables like the one descrbed you - unless you use arrays of objects. You can probably have an array of types of complex objects, but I did not do that.

    If you can not get to COLLECT it in BULK for work use nested loops to put values in the nested tables.

    If the number of items in the 'internal' table is fixed you pouvez use BULK COLLECT with an array of records.

  • sort a pl/sql table

    Hi experts,
    Could you please tell me how can I put all the ename column table emp in a work table pl/sql and display of the enmae in a sorted order.

    Concerning
    Rajat

    Published by: Rene on July 15, 2010 09:47

    Rajat says:
    Thanks, but I don't want to store the value in a table.

    Why not? The best place for data is in a SQL table - where is can be indexed, ordered, filtered, put together and so on.

    It is also not such a thing as a «+ table PL +» This data structures is nothing like a table. It is a collection or a table - which is the correct terminology and terminology for the same data structures in languages ranging from Pascal to Java for Delphi and C/C++.

    Calling it a + "PL table +" creates the false idea that the data structure is SQL table as... which could not be further from the truth. They have almost nothing in common. There is a huge difference between a table and a collection from a table SQL.

    I want to
    table ALIGNMENT (TYPE list IS TABLE OF r_empobj ;) is assigned (type r_empobj IS RECORD (empid number, ename varchar2 (100));)

    These data resides inside the PL language like PL data structures It is not a structure of SQL data.

    The SQL language and the language PL are different languages with different runtimes. PL/SQL integrates and "connects" them--blurs the border between these two languages. But they are still clearly distinct and different languages.

    If you have three choices:

  • write a quick-sort /-bubble sort to sort the data PL. structure plastic
  • Copy the entire structure of data of PL SQL data structure, use the SQL engine for sorting and then copy the entire structure of SQL data in PL.
  • do not use a collection/table of PL structure, but use a SQL table instead.

  • Hi all, how can restrict us and end from 'a droping table' user but need access to the 'workshop of data' to load the data into the spreadsheet.

    Hi all

    How can we limit and end user of "droping a table."

    For example: I created an array of login admin and gave access to "SQL workshop" for the end user. but after that I have created a table, the end user cannot access object browser shop and drop a table. one thing we can do does not have access to the SQL workshop. However, my requirement is the user needs to access the data workshop, which is located under the SQL workshop but they it should not access the tables.

    Kindly let me know how we can do this?

    Thank you

    Vinod Paparaju

    User13309437-Oracle wrote:

    Please update your forum profile with a recognizable username instead of "User13309437": Video tutorial how to change username available

    Always include the information referred to in these guidelines when you post a question: How to get the answers from the forum

    How can we limit and end user of "droping a table."

    For example: I created an array of login admin and gave access to "SQL workshop" for the end user. but after that I have created a table, the end user cannot access object browser shop and drop a table. one thing we can do does not have access to the SQL workshop. However, my requirement is the user needs to access the data workshop, which is located under the SQL workshop but they it should not access the tables.

    Kindly let me know how we can do this?

    There is no way not to restrict access to individual tools in the workshop of SQL. Rather than give the developer-level end-users to access the SQL workshop, create applications containing data support Wizards, where end-user access can be controlled using the standard APEX authentication and authorization schemas.

  • ODI - read CSV file and write to the Oracle table

    Hello world

    After 4 years, I started to work again with ODI, and I'm completely lost.

    I need help, I don't know what to use for each step, interfaces, variables, procedures...

    What I have to do is the following:

    (1) reading a CSV file-> I have the topologies and the model defined

    (2) assess whether there is a field of this CSV file in TABLE A-> who do not exist in the table is ignored (I tried with an interface joining the csv with the TABLE model a model and recording the result in a temporary data store)

    Evaluate 3) I need to update TABLE C and if not I need to INSERT if another field that CSV exists in TABLE B-> if there

    Could someone help me with what use?

    Thanks in advance

    Hi how are you?

    You must:

    Create an interface with the CSV template in the source and a RDBM table in the target (I'll assume you are using Oracle). Any type of filter or the transformation must be defined to be run in the stadium. (you must use a LKM for SQL file and add an IKM Sql control (it is best to trim them and insert the data when it cames to a file if you want after this process, you may have an incremental update to maintain history or something like that).)

    For validation, you will use a reference constraints in the model of the oracle table: (for this you need a CKM Oracle to check constraints)

    Then, you must select the table that you sponsor and in the column, you choose which column you will match.

    To article 3, you repeat the above process.

    And that's all. Pretty easy. If you do not have the two tables that you need to use your validation that you need to load before loading the CSV file you need valid.

    Hope this can help you

  • Calling PL/SQL table...

    I have a procedure called from a package that returns all the data, the package uses a PL/SQL table that I do not know HOW to call or values that I would need to run the XXINV_PWB_HIST_FCST_PUB. XXINV_PWB_ORG_HIST_TBL (structure) with in the package, can someone tell me how it's done?

    Call package is downstairs, the record structure is less than the package call.

    DECLARE

    P_ITEM_NUMBER VARCHAR2 (200);

    DATE OF P_CURRENT_DATE;

    X_PWB_ORG_HIST_TBL APPS. XXINV_PWB_HIST_FCST_PUB. XXINV_PWB_ORG_HIST_TBL;

    BEGIN

    P_ITEM_NUMBER: = NULL;

    P_CURRENT_DATE: = NULL;

    -Modify the code to initialize the variable

    -X_PWB_ORG_HIST_TBL: = NULL;

    XXINV_PWB_HIST_FCST_PUB. () GET_ORG_DETAILS

    P_ITEM_NUMBER = > 91,

    P_CURRENT_DATE = > 2 February 2014 ",

    X_PWB_ORG_HIST_TBL = > X_PWB_ORG_HIST_TBL (which values should I put in the section)

    );

    Legacy release:

    DBMS_OUTPUT. PUT_LINE ('X_PWB_ORG_HIST_TBL =' |) X_PWB_ORG_HIST_TBL);

    -: X_PWB_ORG_HIST_TBL: = X_PWB_ORG_HIST_TBL;

    END;

    TYPE XXINV_PWB_Hist_Tbl IS TABLE OF THE XXINV_PWB_Hist_Rec

    INDEX OF DIRECTORY;

    TYPE XXINV_PWB_Org_Hist_Rec IS RECORD

    (

    Org_Hist_Index_Id NUMBER: = ".

    Item_Number Varchar2 (30): = ".

    Number of Quantity_1: = ".

    Number of Quantity_2: = ".

    Number of Quantity_3: = ".

    Number of Quantity_4: = ".

    Number of Quantity_5: = ".

    Number of Quantity_6: = ".

    Number of Quantity_7: = ".

    Number of Quantity_Total: = ".

    Date of Date_History: = ".

    Month_Year Varchar2 (15): = ".

    Number of Quantity_8: = ");

    Sorry I'm not familiar with PL/SQL tables...

    Thank you

    Help

    I can't go through your entire code. From there, you no need to use this plsql don't table as an input parameter because you do not pass anything... You're just fill with your values hard-coded... Then you can try the below stated

    DECLARE

    -declare the plsql table

    X_PWB_ORG_HIST_TBL APPS. XXINV_PWB_HIST_FCST_PUB. XXINV_PWB_ORG_HIST_TBL;

    BEGIN

    XXINV_PWB_HIST_FCST_PUB. GET_ORG_DETAILS (91, TO_DATE('02-FEB-2014','DD-MON-YYYY'), X_PWB_ORG_HIST_TBL);

    -The legacy output:

    BECAUSE me in X_PWB_ORG_HIST_TBL. FIRST... X_PWB_ORG_HIST_TBL. LAST

    LOOP

    -Add all columns to dbms_output print and test values

    DBMS_OUTPUT. PUT_LINE ('X_PWB_ORG_HIST_TBL =' |) X_PWB_ORG_HIST_TBL (i). Org_Hist_Index_Id | «, » || X_PWB_ORG_HIST_TBL (i). Item_Number);

    END LOOP;

    END;

  • How to execute a SQL statement that is stored within a SQL Table

    Hello

    If someone please help me with the following problem I would be eternally grateful

    I have a SQL statement that is stored inside a certain SQL table, I want to use this SQL statement inside my PL/SQL procedure.

    Thought a simple solution was to get the SQL statement in a table, and then run it, but how could I do so exactly with PL/SQL? I only started to play with PL/SQL in the last days.

    Thanks in advance!

    This is what it looks like more or less:

    Display result for:

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

    SELECT TRIM (OBJ_VALU_TXT)

    OF OBJ_VALU_DOC

    WHERE TYPE_OBJET = 'FLD '.

    AND OBJECT_CODE = 15443

    AND OBJ_VALU_CD = 'CAB '.

    ORDER BYDOC_SEQ_NO

    00001

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

    SELECT

    VALUE (MAX (RECEIPT_NO) + 1,: OUT-COMP-FACTOR)

    THE FRONT DESK

    WHERE (RECEIPT_NO BETWEEN

    (: OUT-COMP-FACTOR AND: OUT TO A NUMBER) OR

    (RECEIPT_NO >: OUT-COMP-FACTOR AND)

    (: OUT-TO-NUMBER = 0)

    Here's a demo of your condition.

    create table t (col1 varchar2 (200));

    table created

    insert into values t ('select * from double ');

    1 row inserted

    declare
    v_col varchar2 (200);
    v_val varchar2 (200);
    Start

    Select col1 in t v_col;

    run immediately v_col in v_val;
    dbms_output.put_line (v_val);
    end;

    -----
    X

    Use in the clause, you can use as many variables as needed. But the basic approach remains the same.

    But storage in DB SQL is not an efficient design.

    Ishan

  • SOA calling a MS SQL table to insert data.

    Hello
    I configured a XA driver to insert data into the MS SQL Server table. When I execute the stream with a SOAP user interface. I was able to insert the data from MS SQL table. But in the end, the transaction is rolled back.


    I would ask you
    < soapenv:Envelope xmlns:soapenv = 'http://schemas.xmlsoap.org/soap/envelope/' xmlns:mvn = "http://xmlns.oracle.com/MVNEIDM/MVNESelfRegistration/MVNESelfRegistration" >
    < soapenv:Header / >
    < soapenv:Body >
    < mvn:MVNESelfRegistrationRequest >
    < mvn:subscriberId > 12345 < / mvn:subscriberId >
    < mvn:Keyword > 456 < / mvn:Keyword >
    < mvn:completionDt > 2013-02-06 T 16: 24:06.952 < / mvn:completionDt >
    < mvn:expirationdt > 2013-02-06 T 16: 24:06.952 < / mvn:expirationdt >
    < / mvn:MVNESelfRegistrationRequest >
    < / soapenv:Body >
    < / soapenv:Envelope >


    Erros on SOAP UI are:

    < env:Envelope = "http://schemas.xmlsoap.org/soap/envelope/" xmlns:env >
    < env:Header / >
    < env:Body >
    < env:Fault >
    env:Server < faultcode > < / faultcode >
    incorrect object name < faultstring > [FMWGEN] [SQLServer JDBC Driver] [SQL Server] ' dbo. SelfRegistration'. < / faultstring >
    < faultactor / >
    < detail >
    < exception / >
    < / details >
    < / env:Fault >
    < / env:Body >
    < / env:Envelope >

    The managed server log the error is


    Form weblogic server: -.
    Error committing transaction:; nested exception is: Exception [EclipseLink-4002] (Eclipse - 2.1.3.v20110304 persistence Services - r9073): org.eclipse.persistence.exceptions.DatabaseException internal Exception: weblogic.jdbc.sqlserverbase.ddc: invalid object name [FMWGEN] [SQLServer JDBC Driver] [SQL Server] ' dbo. SelfRegistration'. Error code: 208


    The process ends with an error, but why he is rolling abck the transaction at the end. The table of the object was existing in the database and I traced the table to insert the data from the input variable reception to invoke the input variable. BPEL Instance he executed until the end, but in the end, the transaction is rolled back.

    Thank you
    Newcomer Raja

    Invalid object name ' dbo. SelfRegistration'

    I'm assuming you can see a SelfRegistration table in your database... So, I guess that BOD is not the name of the diagram on the right...

  • Performance issue Bulk Insert PL/SQL table type

    Hi all

    I put in work of a batch to fill a table with a large number of data records(>3,000,000). To reduce the execution time, I used PL/SQL tables to temporarily store data that must be written to the destination table. Once all documents are piling up in the PL/SQL table I use a FORALL operator for bulk insert the records in the physical table.

    Currently, I follow two approaches to implement the process described above. (Please see the code segments below). I need to choose how to best wise performance between these two approaches. I really appreciate all the comments of experts about the runtime of the two approaches.

    (I don't see much difference in consumption of time in my test environment that has limited the data series. This process involves building a complex set of structures of large product once deployed in the production environment).


    Approach I:_
    DECLARE
    TYPE of test_type IS test_tab % ROWTYPE directory INDEX TABLE;
    test_type_ test_type.
    ins_idx_ NUMBER;
    BEGIN
    ins_idx_: = 1;
    NESTED LOOPS
    test_type_ (ins_idx_) .column1: = value1;
    test_type_ (ins_idx_) .column2: = value2;
    test_type_ (ins_idx_) .column3: = value3;
    ins_idx_: = ins_idx_ + 1;
    END LOOP;

    I_ FORALL in 1.test_type_. COUNTY
    INSERT INTO test_tab VALUES (i_) test_type_;
    END;
    /


    Approach II:_
    DECLARE
    Column1 IS a TABLE OF TYPE test_tab.column1%TYPE INDEX DIRECTORY.
    Column2 IS a TABLE OF TYPE test_tab.column2%TYPE INDEX DIRECTORY.
    Column3 IS a TABLE OF TYPE test_tab.column3%TYPE INDEX DIRECTORY.
    column1 column1_;
    column2_ Column2;
    column3_ Column3;
    ins_idx_ NUMBER;
    BEGIN
    ins_idx_: = 1;
    NESTED LOOPS
    column1_ (ins_idx_): = value1;
    column2_ (ins_idx_): = value2;
    column3_ (ins_idx_): = value3;
    ins_idx_: = ins_idx_ + 1;
    END LOOP;

    FORALL idx_ in 1.column1_. COUNTY
    INSERT
    IN n_part_cost_bucket_tab)
    Column1,
    Column2,
    Column3)
    VALUES)
    column1_ (idx_),
    column2_ (idx_),
    column3_ (idx_));
    END;
    /

    Best regards
    Lorenzo

    Published by: nipuna86 on January 3, 2013 22:23

    nipuna86 wrote:

    I put in work of a batch to fill a table with a large number of data records(>3,000,000). To reduce the execution time, I used PL/SQL tables to temporarily store data that must be written to the destination table. Once all documents are piling up in the PL/SQL table I use a FORALL operator for bulk insert the records in the physical table.

    Performance is more than just reducing the execution time.

    Just as smashing a car stops more than a car in the fastest possible time.

    If it was (breaking a car stopping all simply), then a brick with reinforced concrete wall construction, would have been the perfect way to stop all types of all sorts of speed motor vehicles.

    Only problem (well more than one actually) is that stop a vehicle in this way is bad for the car, the engine, the driver, passengers and any other content inside.

    And pushing 3 million records in a PL/SQL 'table' (btw, that is a WRONG terminology - there no PL/SQL table structure) in order to run a SQL cursor INSERT 3 million times, to reduce the execution times, is no different than using a brick wall to stop a car.

    Both approaches are pretty well imperfect. Both places an unreasonable demand on the memory of the PGA. Both are still row-by-row (aka slow-by-slow) treatment.

  • Is it possible to use the record type or a PL/SQL table in the Select statement

    Hi all

    My requirement is that.
    I want to write a query and write a function, function, I want to return multiple columns at the same time in a Select statement.
    I select the return values in the Select no statement in a PL/SQL block.
    Is it possible to use the PL/SQL Table or Variable of Type record, or any other method in the statement Select?

    Please help me understand the solution.


    Kind regards

    830960 wrote:
    do we like it?

    In general, Yes, if the function is a function table, you can do something like:

    select  t.col1,
            t.col2,
            f.col1,
            f.col2,
            f.col3
      from  table_name t,
               table(some_table_function(param1,...paramN)) f
    /
    

    SY.

  • Selecting rows with nulls in a sql table 3

    Hi everyone I use oracle database 11g and have the following SQL statement:
    SELECT Oprema.Opr_Id, Oprema.Datum_Nabavke, Oprema.Datum_Zaduzenja, Oprema.Dobavljac, Oprema.Jedinica_Mjere,
         coalesce ((Oprema.Zaduzio), 0), Oprema.Vrijednost, Oprema.Kolicina_Nabavna, Oprema.Kolicina_Otpisana, Oprema.Kolicina_Trenutna, Oprema.Status, Oprema.Konto,
         Oprema.KontoIsp, Oprema.Broj_Naloga, Oprema.Sifra_Objekta, Dobavljaci.Naziv AS DobNaz, coalesce(to_char(Uposlenici.Prezime), 'hm'), Objekti.Objekat_ID 
    FROM OPREMA Oprema, UPOSLENICI Uposlenici, DOBAVLJACI Dobavljaci, OBJEKTI Objekti
    WHERE  Oprema.Dobavljac=Dobavljaci.Dob_Id AND Oprema.Zaduzio=Uposlenici.UposlenikId AND Oprema.Sifra_Objekta=Objekti.Objekat_ID
    What I need is to show all the rows in the database. The problem is that some of the foreign key Zaduzio and Objekti have NULL value. This means that the database will not appear those and only shows me the lines where both have values. In all these lines with the exception of 3 one of the two foreign key has a value.

    So what I need is a sql that would show me all 3. As you can see I tried with Coallesce but he did not, although 3 rows show.

    I also tried with UNION
    SELECT Oprema.Opr_Id, Oprema.Datum_Nabavke, Oprema.Datum_Zaduzenja, Oprema.Dobavljac, Oprema.Jedinica_Mjere,
         Oprema.Zaduzio, Oprema.Vrijednost, Oprema.Kolicina_Nabavna, Oprema.Kolicina_Otpisana, Oprema.Kolicina_Trenutna, Oprema.Status, Oprema.Konto,
         Oprema.KontoIsp, Oprema.Broj_Naloga, Oprema.Sifra_Objekta, Dobavljaci.Naziv AS DobNaz, Uposlenici.Prezime, Objekti.Objekat_ID 
    FROM OPREMA Oprema, UPOSLENICI Uposlenici, DOBAVLJACI Dobavljaci, OBJEKTI Objekti
    WHERE  Oprema.Dobavljac=Dobavljaci.Dob_Id AND Oprema.Zaduzio=Uposlenici.UposlenikId AND Oprema.Sifra_Objekta=Objekti.Objekat_ID
    But then the lines containing values both Zaduzio and Objekti are multiplied and selected twice.

    So any ideas on how to do this?

    Hello

    If foreign keys are NULL, an inner join will produce no results. You may need to do an outer join, like this:

    SELECT  Oprema.Opr_Id
    ,      Oprema.Datum_Nabavke
    ,      Oprema.Datum_Zaduzenja
    ,      Oprema.Dobavljac
    ,      Oprema.Jedinica_Mjere
    ,     COALESCE ( Oprema.Zaduzio
               , 0
               )          AS zaduzio_or_0
    ,      Oprema.Vrijednost
    ,      Oprema.Kolicina_Nabavna
    ,      Oprema.Kolicina_Otpisana
    ,      Oprema.Kolicina_Trenutna
    ,      Oprema.Status
    ,      Oprema.Konto,
         Oprema.KontoIsp
    ,      Oprema.Broj_Naloga
    ,      Oprema.Sifra_Objekta
    ,      Dobavljaci.Naziv     AS DobNaz
    ,      COALESCE ( TO_CHAR (Uposlenici.Prezime)
               , 'hm'
               )          AS prezime_or_hm
    ,      Objekti.Objekat_ID
    FROM            OPREMA
    JOIN            DOBAVLJACI  ON   Oprema.Dobavljac      = Dobavljaci.Dob_Id
    LEFT OUTER JOIN      UPOSLENICI  ON       Oprema.Zaduzio     = Uposlenici.UposlenikId
    LEFT OUTER JOIN  OBJEKTI     ON       Oprema.Sifra_Objekta  = Objekti.Objekat_ID
    ;
    

    I hope that answers your question.
    If not, post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and the results desired from these data.
    Simplify the problem. For example, if you really need display 18 columns, but 15 of them have nothing to do with the problem, and then ask a question that includes just e or 4 of these columns.
    Explain, using specific examples, how you get these results from these data.
    Always say what version of Oracle you are using (for example, 11.2.0.2.0).
    See the FAQ forum {message identifier: = 9360002}

  • PL/SQL tables

    Hello guys,.
    I have a few questions about the PL/SQL tables

    (1) if I don't specify the 'INDEX BY' clause, they are indexed by PLS_INTEGER default, right?

    (2) consider this package specification
    CREATE OR REPLACE PACKAGE Testxyz AS
    
    TYPE tab_Numbers IS TABLE OF PLS_INTEGER;
    
    PROCEDURE TestNumber(ptab_Numbers IN tab_Numbers := NULL);
    
    
    END Testxyz;
    So I created a table (I hope it's standard indexed by type of data pls_integer) and I am in him passing as parameter to a procedure. Because I want this parameter be optional I assign null inside.

    Now, I change the table definition for:
    CREATE OR REPLACE PACKAGE Testxyz AS
    
    TYPE tab_Numbers IS TABLE OF PLS_INTEGER INDEX BY PLS_INTEGER;
    
    PROCEDURE TestNumber(ptab_Numbers IN tab_Numbers := NULL);
    
    
    END Testxyz;
    Try to compile it and you get:
    Error (5.53): PLS-00382: expression is of the wrong type

    Why?

    (3) because I need this optional parameter, I use the first statement:
    CREATE OR REPLACE PACKAGE Testxyz AS
    
    TYPE tab_Numbers IS TABLE OF PLS_INTEGER;
    
    PROCEDURE TestNumber(ptab_Numbers IN tab_Numbers := NULL);
    
    
    END Testxyz;
    Now I create an anonymous block, and you want to set something in the table
    DECLARE
       vtab_Numbers TESTXYZ.tab_Numbers;
    BEGIN
    
       vtab_Numbers(1) := 5;
    
    
    END;
    /
    When you try to run it, I got:
    06531 00000 - 'refers to an uninitialized collection.

    Can someone help me understand this problem?
    Is it possible to have input of type PL/SQL table setting and have a standard null, are assigned?

    Thanks, Dan

    (1) if I don't specify the 'INDEX BY' clause, they are indexed by PLS_INTEGER default, right?

    N ° or somehow.

    More critical, and using official terms of [url http://docs.oracle.com/cd/E11882_01/appdev.112/e25519/composites.htm#CHDBHJEI] documentation so that we don't get into unnecessary arguments about the correct terms for these features, it's the difference between types of ASSOCIATIVE TABLE and the IMBRIQUEE TABLE collection.

    If you omit the "INDEX BY" clause, it is a type of TABLE IMBRIQUEE collection. A type of TABLE IMBRIQUEE is always indexed by PLS_INTEGER.

    When you include the ' INDEX OF ', this is an ASSOCIATIVE ARRAY.

    (2) consider this package specification
    Try to compile it and you get:
    Error (5.53): PLS-00382: expression is of the wrong type

    Why?

    Because you cannot assign NULL to an ASSOCIATIVE ARRAY.

    In the same way, you cannot do this:

    SQL> DECLARE
      2   TYPE tab_Numbers IS TABLE OF PLS_INTEGER INDEX BY PLS_INTEGER;
      3   v1 tab_Numbers;
      4  BEGIN
      5   v1 := NULL;
      6  END;
      7  /
     v1 := NULL;
           *
    ERROR at line 5:
    ORA-06550: line 5, column 8:
    PLS-00382: expression is of wrong type
    ORA-06550: line 5, column 2:
    PL/SQL: Statement ignored
    
    SQL> 
    

    If you want two entry points to TestNumber with an ASSOCIATIVE ARRAY or NULL then overload the procedure.

    If you want to call a procedure with a TABLE IMBRIQUE collection type you can the default empty:

    SQL> CREATE OR REPLACE PACKAGE Testxyz
      2  AS
      3   TYPE tab_Numbers IS TABLE OF PLS_INTEGER;
      4   PROCEDURE TestNumber(ptab_Numbers IN tab_Numbers DEFAULT tab_Numbers());
      5   PROCEDURE TestNumber;
      6  END Testxyz;
      7  /
    
    Package created.
    
    SQL> 
    

    (3) because I need this optional parameter, I use the first statement
    When you try to run it, I got:
    06531 00000 - 'refers to an uninitialized collection.

    Because you have not initialized it.

    Different collection types require different semantics.

    SQL> DECLARE
      2   TYPE tab_Numbers IS TABLE OF PLS_INTEGER;
      3   v1 tab_Numbers;
      4  BEGIN
      5   v1(1) := 5;
      6  END;
      7  /
    DECLARE
    *
    ERROR at line 1:
    ORA-06531: Reference to uninitialized collection
    ORA-06512: at line 5
    
    SQL> DECLARE
      2   TYPE tab_Numbers IS TABLE OF PLS_INTEGER;
      3   v1 tab_Numbers := tab_Numbers();
      4  BEGIN
      5   v1(1) := 5;
      6  END;
      7  /
    DECLARE
    *
    ERROR at line 1:
    ORA-06533: Subscript beyond count
    ORA-06512: at line 5
    
    SQL> DECLARE
      2   TYPE tab_Numbers IS TABLE OF PLS_INTEGER;
      3   v1 tab_Numbers := tab_Numbers();
      4  BEGIN
      5   v1.extend();
      6   v1(1) := 5;
      7  END;
      8  /
    
    PL/SQL procedure successfully completed.
    
    SQL> 
    
  • Help with PL/SQL table

    Hi all

    Newbie when it comes to PL/SQL tables...

    Can someone explain to me why it works and how exactly I can do the following without triggering an error?

    I have a function that accepts a PL/SQL table like in parameter.

    The PL/SQL table is defined as...
    Type TTimeTable is table of xxtzg_otl_iface_stg%rowtype index by binary_integer;
    the xxtzg_otl_iface_stg table has many columns including error_message and error_flag. If I find an error, I want to update the error_message and error_flag function. If I can get it works I will then modify the function to return to the table of PL/SQL instead of BOOLEAN
    FUNCTION validate_timecard (pTimeTable IN TTimeTable
                                                 ) RETURN BOOLEAN IS
    
      lc_module            CONSTANT VARCHAR2(25)        := 'validate_timecard';
      lEmployeeCount    PLS_INTEGER;
      lEmployeeError     VARCHAR2(1000);
      lErrorCount          PLS_INTEGER :=0;
      
      BEGIN
    
         FOR i IN 1 .. NVL(pTimeTable.COUNT,0) LOOP                                   
                                             
         xxtzg_concurrent_utils_pkg.write_log(  p_package =>  gc_package
                                                                , p_module  =>  lc_module
                                                                , p_text    =>  'Processing timecard for employee_number: '||pTimeTable(1).employee_number
                                                               );               
       
         -- Call validations before submitting the timecard to the API
         --validate employee
    
            begin
               select count(*)
                 into lEmployeeCount
                 from per_all_people_f
                where employee_number = pTimeTable(1).employee_number;
                
                if lEmployeeCount = 0 then
                
                -- Set the errors
    
                -- This assignment below does not work, I get an error message saying...
                --[Error] PLS-00363 (137: 27): PLS-00363: expression 'PTIMETABLE.ERROR_MESSAGE' cannot be used as an assignment target
    
                PTimeTable(i).error_message :=  'Employee Number '||pTimeTable(1).employee_number||' is not a valid employee';
                PTimeTable(i).error_flag := 'Y';
    
                end if;
                
            end;    
            
         END LOOP; 
         
         IF lErrorCount = 0 THEN 
         RETURN TRUE;
         ELSE
         RETURN FALSE;
         END IF;
                                               
      END;

    blue72TA wrote:

    FUNCTION validate_timecard (pTimeTable IN TTimeTable
    ) RETURN BOOLEAN IS
    ...
    
    -- This assignment below does not work, I get an error message saying...
    --[Error] PLS-00363 (137: 27): PLS-00363: expression 'PTIMETABLE.ERROR_MESSAGE' cannot be used as an assignment target
    
    PTimeTable(i).error_message :=  'Employee Number '||pTimeTable(1).employee_number||' is not a valid employee';
    PTimeTable(i).error_flag := 'Y';
    

    Your table is declared as IN only (the default if you do not explicitly set it), so you are not allowed to change its attributes in all respects, IN = read-only.

    If you want to be able to modify the values of a parameter, it must be declared as OUT parameters.

Maybe you are looking for