Oracle equivalent for temp table variable

Can anyone help me regarding this..
sample code
declare @temptable table (fldcaptioncode bigint, fldrownumber bigint identity (1,1))
i have declaration in sqlserver stored procedure,
Is there any equivalent in oracle 10g
Thanks in advance
Regards
Ariff

Ariff,
temporary tables are supported by Oracle, and SQL Developer uses this feature.
The DDL of the temporary table is extracted and generated as a standalone object.
Please check docs, since there are several examples and informations about tem tables. Docs are available at
http://download.oracle.com/docs/cd/E12151_01/index.htm
or
http://www.oracle.com/technology/tech/migration//workbench/index_sqldev_omwb.html
Thanks
Regards,
MGILIBER

Similar Messages

  • Oracle equivalent for OBJECTPROPERTY

    Hi Friends,
    I want the oracle equivalent for the following sql code,
    Select @Command = 'IF OBJECTPROPERTY(object_id('''+ @TableName + '''), ''TableHasForeignRef'') = 1
                              DELETE FROM ' + @TableName + '
                          ELSE
                              TRUNCATE TABLE ' + @TableName
    EXEC sp_MSForEachTable @CommandI have tried to find out, but no use. Please help me.
    Thanks,
    Ram.

    Ram wrote:
    I have tested a table which has foreign key. But the count returned from the query is 0.
    Have I implemented your query in the right way?Same like in SQL Server, Oracle does not allow truncating table if it has a PK or UK which is referenced by FK. There are no issues truncating table with FK. Again, it is table with PK/UK where you might not be able to truncate if that PK/UK is referenced by FK. And SQL Server property TableHasForeignRef = TRUE means there is a FK (on a different table or maybe even on same table if it is self-referencing FK) which is referencing PK/UK on a table in question. Query I suggested returns 1 if table has a PK or UK which is referenced by FK. Otherwise it returns 0. So if, in your case, table MY_TABLE owned by user DBO_XYZ has just FK, 0 is correct and you can truncate it. If it would return 1, you would not be able to truncate and would have to delete.
    SY.

  • How to use temp table/variable

    Hello,
    It's SQL 2008 R2. I need to bring data from Oracle using .Net Providers/ODBC Data Provider to MS SQL table converting Oracle UTC dates to PST.  The source connection type cannot be changed as it's given. For the Destination I'm using the OLE DB.
    As the truncate all and load could take time I'm trying to use a temp table or a variable to use it further with t-sql merge or not exists to bring/add the only new records to the destination table.
    I'm trying different scenarios that is all failed.
    Scenario A:
    1. In DTF after OLE DB Source I'm using the Derived Colum to convert dates. It's working well.
    2. Then use Recordset Destination with an object variable User::obj_TableACD. It's also working well.
    3. Then I created a string variable with a simple query that I could modify later "select * from " + (DT_WSTR,10)@[User::obj_TableACD] trying to get data from the recordset object variable but it's not working.
    Scenario B:
    1. Created a store procedure to create a temp table.
    2. Created a string variable to execute SP str_CreateTempTable: "EXEC dbo.TempTable". It's working well with the SQL Task with SQLSourceType as Variable.
    3. Then how to populate the temp table from the Oracle source to bring data into the Destination?
    I could spend another few days to figure it out. So, please help me on it if there is a way to solve it.
    Thanks

    Thank you so much, Nitesh. Now, I got the understanding of temp tables in SSIS. However, in my case to implement t-sql merge or not exists to bring the new records only I'd need to load at least a one table into a temp table anyway. So, why not to use a
    destination table instead. I also noticed a one remark from the article you suggested that the expert who wrote the article had never actual used the temp tables in SSIS.
    So, I decided to go with truncate, drop keys, derive columns, load, and create keys again in the destination table.
    Thank you again, I'll reserve the knowledge I got for the temp SSIS tables for some other cases.

  • SQL tune for temp table

    I am executing a query for which there is a system temp table is used, How could i tune for better execution?
    Please see the execution plan below
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 25 | 2650 | 83 (2)| 00:00:01 |
    |* 1 | COUNT STOPKEY | | | | | |
    | 2 | NESTED LOOPS | | | | | |
    | 3 | NESTED LOOPS | | 25 | 2650 | 83 (2)| 00:00:01 |
    | 4 | NESTED LOOPS | | 25 | 1900 | 81 (2)| 00:00:01 |
    | 5 | VIEW | | 603 | 28341 | 78 (2)| 00:00:01 |
    | 6 | TEMP TABLE TRANSFORMATION | | | | | |
    | 7 | LOAD AS SELECT | PRODUCTS | | | | |
    | 8 | HASH UNIQUE | | 114 | 2736 | 1435 (2)| 00:00:18 |
    |* 9 | HASH JOIN | | 114 | 2736 | 1434 (2)| 00:00:18 |
    |* 10 | TABLE ACCESS FULL | CUSTOMERS | 65 | 780 | 865 (2)| 00:00:11 |
    | 11 | TABLE ACCESS BY INDEX ROWID | ORDER_LINES | 252K| 2956K| 567 (1)| 00:00:07 |
    |* 12 | INDEX RANGE SCAN | OL_O1 | 252K| | 85 (0)| 00:00:02 |
    | 13 | SORT ORDER BY | | 603 | 81405 | 439 (3)| 00:00:06 |
    | 14 | HASH GROUP BY | | 603 | 81405 | 439 (3)| 00:00:06 |
    |* 15 | HASH JOIN RIGHT ANTI | | 603 | 81405 | 437 (2)| 00:00:06 |
    | 16 | VIEW | | 114 | 912 | 2 (0)| 00:00:01 |
    | 17 | TABLE ACCESS FULL | SYS_TEMP_0FD9D6B20_523F10 | 114 | 912 | 2 (0)| 00:00:01 |
    |* 18 | HASH JOIN | | 604 | 76708 | 435 (2)| 00:00:06 |
    | 19 | TABLE ACCESS BY INDEX ROWID | PRODUCTS | 411 | 8220 | 6 (0)| 00:00:01 |
    |* 20 | INDEX RANGE SCAN | PR_U2 | 411 | | 1 (0)| 00:00:01 |
    |* 21 | HASH JOIN | | 2177 | 227K| 428 (2)| 00:00:06 |
    | 22 | NESTED LOOPS | | | | | |
    | 23 | NESTED LOOPS | | 7348 | 423K| 325 (2)| 00:00:04 |
    |* 24 | HASH JOIN | | 114 | 3078 | 176 (3)| 00:00:03 |
    | 25 | VIEW | | 114 | 912 | 2 (0)| 00:00:01 |
    | 26 | TABLE ACCESS FULL | SYS_TEMP_0FD9D6B20_523F10 | 114 | 912 | 2 (0)| 00:00:01 |
    |* 27 | TABLE ACCESS FULL | CUSTOMER_CLUSTERS | 86315 | 1601K| 173 (2)| 00:00:03 |
    |* 28 | INDEX RANGE SCAN | IDX_RULES_COMM_ANTE_PROB | 64 | | 1 (0)| 00:00:01 |
    | 29 | TABLE ACCESS BY INDEX ROWID| RULES | 64 | 2048 | 1 (0)| 00:00:01 |
    |* 30 | TABLE ACCESS FULL | CLUSTER_PRODUCTS | 18418 | 863K| 103 (1)| 00:00:02 |
    | 31 | TABLE ACCESS BY INDEX ROWID | CUSTOMERS | 1 | 29 | 1 (0)| 00:00:01 |
    |* 32 | INDEX UNIQUE SCAN | CU_PK | 1 | | 1 (0)| 00:00:01 |
    |* 33 | INDEX UNIQUE SCAN | PR_PK | 1 | | 1 (0)| 00:00:01 |
    | 34 | TABLE ACCESS BY INDEX ROWID | PRODUCTS | 1 | 30 | 1 (0)| 00:00:01 |
    ---------------------------------------------------------------------------------------------------------------------

    ID 17 and 26
    17 | TABLE ACCESS FULL | SYS_TEMP_0FD9D6B20_523F10 | 114 | 912 | 2 (0)| 00:00:01 |

  • How to create Nested table in oracle stored procedure(Temp Table)

    Hi
    I am creating Nested table in stored procedure(Temp Table)
    type t_v_tbl_rec is record(cumid number,col1 varchar(50),col2 varchar(50),col3 varchar(50),col4 varchar(50),col5 varchar(50),col6 varchar(50));
    type t_v_tbl is table of t_v_tbl_rec index by binary_integer;
    V_V_TBL t_v_tbl;
    But i can't insert value in to this temp table
    Plz help me

    What is problem?
    SQL>declare
      2      type t_v_tbl_rec is record( cumid number,
      3                                  col1 varchar(50),
      4                                  col2 varchar(50),
      5                                  col3 varchar(50),
      6                                  col4 varchar(50),
      7                                  col5 varchar(50),
      8                                  col6 varchar(50) );
      9      type t_v_tbl is table of t_v_tbl_rec index by binary_integer;
    10      v_v_tbl t_v_tbl;
    11  begin
    12      v_v_tbl(1).cumid := 1;
    13      dbms_output.put_line(v_v_tbl(1).cumid);
    14  end;
    15  /
    1
    PL/SQL procedure successfully completed.

  • ROWNUM equivalent for Nested Tables?

    Is there an equivalent to the ROWNUM pseudocolumn for a nested table such that something like this...
    WITH driver_data AS
      (SELECT 1 AS id, sys.dbms_debug_vc2coll('a','b','c') AS val FROM dual
      UNION ALL
      SELECT 2 AS id, sys.dbms_debug_vc2coll('x','y','z') AS val FROM dual)
    SELECT t1.id,
      --t2.rownum as pos,
      t2.column_value AS val
    FROM driver_data t1,
         TABLE(t1.val) t2 ;
    ID     VAL
    1     a
    1     b
    1     c
    2     x
    2     y
    2     z...would return something like this...
    ID     VAL  POS
    1     a      1
    1     b      2
    1     c      3
    2     x      1
    2     y      2
    2     z      3

    ABB wrote:
    But the OP now has two collections per row of data, not one, as he showed above, so it becomes more complicated.Yes, it does. But still solvable:
    with t1 as (
                select  t1.*,
                        rownum rn_main
                  from  driver_data t1
         t2 as (
                select  id,
                        val1,
                        rn_main,
                        row_number() over(partition by rn_main order by rn_nested) pos
                  from  (
                         select  id,
                                 column_value val1,
                                 rn_main,
                                 rownum rn_nested
                           from  t1,
                           table(val1)
         t3 as (
                select  id,
                        val2,
                        rn_main,
                        row_number() over(partition by rn_main order by rn_nested) pos
                  from  (
                         select  id,
                                 column_value val2,
                                 rn_main,
                                 rownum rn_nested
                           from  t1,
                           table(val2)
    select  nvl(t2.id,t3.id) id,
            val1,
            val2,
            nvl(t2.pos,t3.pos) pos
      from  t2 full outer join t3 on t2.rn_main = t3.rn_main and t2.pos = t3.pos
      order by nvl(t2.rn_main,t3.rn_main),
               nvl(t2.pos,t3.pos)
    SQL> create table driver_data(
      2                           id number,
      3                           val1 sys.dbms_debug_vc2coll,
      4                           val2 sys.dbms_debug_vc2coll
      5                          )
      6    nested table val1 store as val1_tbl,
      7    nested table val2 store as val2_tbl
      8  /
    Table created.
    SQL> insert
      2    into driver_data
      3    SELECT  1 id,
      4            sys.dbms_debug_vc2coll('c','b','a') val1,
      5            sys.dbms_debug_vc2coll('k','u') val2
      6      FROM  dual
      7   UNION ALL
      8    SELECT  2 id,
      9            sys.dbms_debug_vc2coll('z','y','x') val1,
    10            sys.dbms_debug_vc2coll('n','e','j','t') val2
    11      FROM  dual
    12   UNION ALL
    13    SELECT  1 id,
    14            sys.dbms_debug_vc2coll('c','b','a') val1,
    15            sys.dbms_debug_vc2coll('k','u') val2
    16      FROM  dual
    17   UNION ALL
    18    SELECT  2 id,
    19            sys.dbms_debug_vc2coll('z','y','x') val1,
    20            sys.dbms_debug_vc2coll('n','e','j','t') val2
    21      FROM  dual
    22  /
    4 rows created.
    SQL> commit
      2  /
    Commit complete.
    SQL> column val1 format a10
    SQL> column val2 format a10
    SQL> with t1 as (
      2              select  t1.*,
      3                      rownum rn_main
      4                from  driver_data t1
      5             ),
      6       t2 as (
      7              select  id,
      8                      val1,
      9                      rn_main,
    10                      row_number() over(partition by rn_main order by rn_nested) pos
    11                from  (
    12                       select  id,
    13                               column_value val1,
    14                               rn_main,
    15                               rownum rn_nested
    16                         from  t1,
    17                         table(val1)
    18                      )
    19             ),
    20       t3 as (
    21              select  id,
    22                      val2,
    23                      rn_main,
    24                      row_number() over(partition by rn_main order by rn_nested) pos
    25                from  (
    26                       select  id,
    27                               column_value val2,
    28                               rn_main,
    29                               rownum rn_nested
    30                         from  t1,
    31                         table(val2)
    32                      )
    33             )
    34  select  nvl(t2.id,t3.id) id,
    35          val1,
    36          val2,
    37          nvl(t2.pos,t3.pos) pos
    38    from  t2 full outer join t3 on t2.rn_main = t3.rn_main and t2.pos = t3.pos
    39    order by nvl(t2.rn_main,t3.rn_main),
    40             nvl(t2.pos,t3.pos)
    41  /
            ID VAL1       VAL2              POS
             1 c          k                   1
             1 b          u                   2
             1 a                              3
             2 z          n                   1
             2 y          e                   2
             2 x          j                   3
             2            t                   4
             1 c          k                   1
             1 b          u                   2
             1 a                              3
             2 z          n                   1
            ID VAL1       VAL2              POS
             2 y          e                   2
             2 x          j                   3
             2            t                   4
    14 rows selected.
    SQL> SY.

  • Oracle equivalent for MS Sql Server WITH(NOLOCK)

    Hi all :-)
    What is the equivalent of MS Sql Server WITH(NOLOCK)
    hint in Oracle ... or ... how can I achieve the same
    effect in Oracle SELECT queries ?

    = dirty read .
    to the op : read the concepts guide before going further; Oracle implements a different concurrency model than SQL Server

  • Oracle equivalent for @@minuserid and @@maxuserid

    im migrating from sybase to oracle,.. and in some stored procedure this 2 global parameters are use:
    @@minuserid: min. user id
    @@maxuserid: maximum user id
    is there any equivalent in oracle 10g??

    No, there isn't.
    What are you trying to do with @@minuserid and @@maxuserid?
    Maybe we can think about coding around.

  • How to use "Auto increment" in temp table Oracle

    Pleas tell me yaar,
    In MS Sql for Auto increment i am using like this "seqid int identity" for temp table
    t_seq_tbl table(seqid int identity,EVENT_SEQ_NO varchar(30))
    In oracle how to use....

    As far as I know there is not any auto increment data type in Oracle. Instead of this you should create a sequence and get the next value of the sequence while creating a row in your table.
    CREATE SEQUENCE Test_Sequence ;
    CREATE TABLE Test_Table ( Id NUMBER , Foo VARCHAR2(4) ) ;
    ALTER TABLE Test_Table ADD CONSTRAINT Test_Table_PK_Id PRIMARY KEY ( Id ) ;
    INSERT INTO Test_Table ( Id , Information ) VALUES ( Test_Sequence.NEXTVAL , 'FOO' ) ;

  • Visual Basic, DAO, Temp tables in stored procedures

    Client code currently uses DAO with SQLPassthrough option in VB to connect to SQl 6.5 db.
    I migrated all stored procedures with default options except Oracle 8i temp tables. For every procedure a package and a procedure was created. We use SQL server temporary tables extensively in a few hundred stored procedures. The ref cursor created refers to the temporary table. While migratiing, Create table statement is commented. How are SQL6.5 equivalent of temp tables handled in Oracle? Is there an alternative to temp tables?
    I also migrated to another oracle db using the INOUT type for stored procedures. This time only procedures were created. Can these procedures return a record set in DAO with SQLPAssthrough?
    How do you call a procedure using DAO in VB to get recordsets?
    What is the best way to migrate to Oracle with minimal client code changes?
    Thank you in advance.
    Umesh
    null

    Karthick_Arp wrote:
    BluShadow wrote:
    I agree with Karthick, there's no need for a temporary table in this situation.
    And to add, temporary tables should not be created at runtime, they should be part of the initial design of the database, created once and used as needed. Creating them at runtime is just wrong.The problem is the name oracle has given to GTT. The word Temporary mislead lot of SQL Server developers and they think its something same as the temporary table used in SQL Server :)Yeah, Ingres does something similar to SQL Server too, in that you can create a temporary table (Ingres assigned it a unique name and tells you what it is), and you set an expiry time on it (i.e. set it to expire in 1 days time), and then a background process is supposed to clean up the tables that have expired. Unlike Oracle, they are not session specific, but become visible to all once created.
    I think there's room for both types of temporary table, but Oracle's does the job (except when you want to use them from a stateless application front end).

  • Temp tables in procedure

    Hi,
    I am trying to develop a procedure in which i have to create four tables to improve the performance of the procedure.
    is there any other way in which i can do this? i don't want to create four table objects. if i use global temporary table. then also it will create structure in DB. i tried with table of records method. that is getting too complicated since its a very big procedure.
    can anyone suggest me other ways of achieving this?

    user12288167 wrote:
    this procedure is called at the same time by 10 different interfaces. the procedure has 4 temp tables now, which are required to improve the performance. after all the processing is done it will insert the result into a final table. Temp tables are not required to improve performance. In fact, it slows things down and make performance worse.
    What db operation has the single largest performance impact? I/O.
    What does your so-called "+improvment+" do with temp tables? Generate more I/O for creating data in the temp tables and manipulate data in the temp tables.
    So, how can generating more I/O be a performance improvement??
    so we need separate tables for all these interfaces.i.e. 5*10=50 tables in all which is not acceptable by our project.
    or is there any way to implement wait in the procedure while it is being accessed somewhere else?You need to scrap that procedure entirely. It is pretty much junk and will perform like junk.
    There is very seldom a need for temp tables in Oracle. Very Important: The reasons for using temp tables in SQL-Server/Informix/etc DOES NOT exist in Oracle.
    In Oracle, readers of data NEVER blocks writers of data. And writers of data NEVER blocks readers of data. Oracle provides and guarantees read consistency. There is no need for temp tables to deal with the lack of data consistency or (unwarranted) read/write serialisation.
    Read up on Oracle read consistency - and use that, correctly. Without resorting to hacks like you had to do with temp tables in other (inferior) database products.

  • Is it possible to create table variable by copying structure of existing table?

    Greetings community,
    It’s a newbie question.
    I’m still learning T-SQL, and I’m not very familiar with its syntax, so I’m not sure if I’m asking something stupid. I’m creating a “stored function”. I need to create temporary table variable to do some “thinking” in it and spit out a
    scalar result. Actually, I have to create about ten similar functions to process ten tables in similar way, so I was searching is it possible to speed it up.
    I was wondering is there any way, instead of declaring table variable with list of gazillion columns (and having the possibility to mistype something), to declare table variable so it would inherit structure of existing table.
    Thanks for any help.

    Temp table variable can not be created on the fly, but temp table can be created.
    If you want just the structure, you can use the below.
    SELECT Top 0
    INTO #temp
    FROM
    Sales.SalesOrderHeader

  • How i can disable MONITORING temp tables

    In the Oracle 10 g database stats are gathering using
    Gtaher_stats_job
    current setting is statictics _level =Typical
    i need to disable the monotoring for temp tables
    i try this command it will not change
    ALTER TABLE "RDC"."INV_TEMP"
    NOMONITORING
    How i can disable this , i read some artikel this feature is disabled in oracle 10g
    how i can disable
    tks
    rda

    Justin Note
    I would suggest that this is probably a bad idea, though. If there are no statistics on an object,
    you're basically asking the CBO to work blind. Why not gather statistics after loading a fresh set of data
    into the table?
    I am running stats once a week , so i cannnot gather fresh set of dataNicolas
    setting stats to a given value and lock them (to be not set to 0 by any gather stat process) may help as well.
    Justin
    Nicolas.
    I cannot understand this >>to be not set to 0 by any gather stat processOk my process as follows
    through sqlldr i load a data to temp table , i have a after insert trigger
    once the data insert into temp table it check for some condition and
    fire this trigger and insert into Permanent Table,
    After the process finished the temp table truncated.
    this whole process running every day .
    I already mention stats are collected once a week , no point i keep the stats
    for this temp table and suppose if i keep , it will give wong execution plan
    and insert into this temp tabel will be slow -- am i right in this step
    This is the reason i dont want stats at all in temp table
    Thanks Justin & Nicolas
    Best rds

  • Fixing this Table Variable Query

    Please assist me to correct this syntax for this Table Variable Question below.   
    /* Create a table variable with Departure City and State in 2 different columns along 
    with Flight Destination City and Ontime. */
    DECLARE @NTable TABLE (FlightDepartureCity varchar(50), FlightDepartureCity1 varchar(50),FlightDestinationCity varchar(50), [Ontime] INT)
    INSERT INTO @NTable 
    SELECT Left(FlightDepartureCity,CHARINDEX('-',FlightDepartureCity)-1) as City,
    RIGHT(FlightDepartureCity,LEN(FlightDepartureCity) - CHARINDEX('-',FlightDepartureCity)) as FirstName,
    FlightDestinationCity, Ontime
    FROM Flights
    SELECT Left(FlightDepartureCity,CHARINDEX('-',FlightDepartureCity)-1),
        RIGHT(FlightDepartureCity,LEN(FlightDepartureCity) - CHARINDEX('-',FlightDepartureCity))  , 
        FlightDestinationCity, Ontime FROM @NTable

    Disregard I figured it out
    DECLARE @NTable TABLE (FlightDepartureCity varchar(50), FlightDepartureCity1 varchar(50),FlightDestinationCity varchar(50), [Ontime] INT)
    INSERT INTO @NTable 
    SELECT Left(FlightDepartureCity,CHARINDEX('-',FlightDepartureCity)-1) as City,
    RIGHT(FlightDepartureCity,LEN(FlightDepartureCity) - CHARINDEX('-',FlightDepartureCity)) as FirstName,
    FlightDestinationCity, Ontime
    FROM Flights
    SELECT * from @NTable

  • Oracle equivalent to SQL Server Table Variables ?

    Does Oracle have anything equivalent to SQL Server table variables, that can be used in the JOIN clause of a select statement ?
    What I want to do is execute a query to retrieve a two-column result, into some form of temporary storage (a collection ?), and then re-use that common data in many other queries inside a PL/SQL block. I could use temporary tables, but I'd like to avoid having to create new tables in the database, if possible. If I was doing this in SQL Server, I could use a table variable to do this, but is there anything similar in Oracle ? SQL Server example:
    use Northwind
    DECLARE @myVar TABLE(CustomerID nchar(5), CompanyName nvarchar(40))
    INSERT INTO @myVar(CustomerID, CompanyName)
    select CustomerID, CompanyName
    from Customers
    --Join the variable onto a table in the database
    SELECT *
    FROM @myVar mv join Customers
    on mv.CompanyName = Customers.CompanyName
    The closest I've found in Oracle is to use CREATE TYPE to create new types in the database, and use TABLE and CAST to convert the collection to a table, as shown below. I can't see anyway without creating new types in the database.
    CREATE TYPE IDMap_obj AS Object(OldID number(15), NewID number(15));
    CREATE TYPE IDMap_TAB IS TABLE OF IDMap_obj;
    DECLARE
    v_Count Number(10) := 0;
    --Initialize empty collection
    SourceIDMap IDMap_TAB := IDMap_TAB();
    BEGIN
    --Populate our SourceIDMap variable (dummy select statement for now).
    FOR cur_row IN (select ID As OldID, ID + 10000000 As NewID From SomeTable) LOOP
    SourceIDMap.extend;
    SourceIDMap(SourceIDMap.Last) := IDMap_obj(cur_row.OldId, cur_row.NewId);
    END LOOP;
    --Print out contents of collection
    FOR cur_row IN 1 .. SourceIDMap.Count LOOP
    DBMS_OUTPUT.put_line(SourceIDMap(cur_row).OldId || ' ' || SourceIDMap(cur_row).NewId);
    END LOOP;
    --OK, can we now use our collection in a JOIN statement ?
    SELECT COUNT(SM.NewID)
    INTO v_Count
    FROM SomeTable ST JOIN
    TABLE(CAST(SourceIDMap As IDMap_TAB)) SM
    ON ST.ID = SM.OldID;
    DBMS_OUTPUT.put_line(' ' );
    DBMS_OUTPUT.put_line('v_Count is ' || v_Count);
    END;

    Hi, got this from our plsql guys:
    The term "table function" is a bit confusing here. In Oracle-speak, it means a function that can be used in the from list of a select statement thus:
    select * from Table(My_Table_Function()),..
    where...
    The function's return type must be a collection that SQL understands. So for the interesting case -- mimicking a function with more than one column -- this would be a nested table of ADTs where both the ADT and the nested table are defined at schema level. PL/SQL -- by virtue of some clever footwork -- allows you to declare the type as a nested table of records where both these types are declared in a package spec. This alternative is generally preferred, especially because the nested table can be of Some_Table%rowtype (or Some_Cursor%rowtype if you prefer).
    As I understand it from our man on the ANSI committee, our use terminology follows the standard.
    The construct below seems to be a bit different (though there are similarities) because it appears from your code sample that it's usable only within procedural code. And the object from which you select is a variable rather than a function.
    So, after that preamble... the answer would be:
    No, we don't have any constructs to let you "declare" something that looks like a regular schema-level table as a PL/SQL variable -- and then use (static) SQL on it just as if it were a schema-level table.
    But yes, you can use PL/SQL's pipelined table function to achieve much of the same effect.
    Look at the attached Table_Function.sql.
    It shows that you can populate a collection of records using ordinary PL/SQL code. You can't use SQL for insert, update, or delete on such a collection. I see that SQL Server lets you do
    insert into Program_Variable_Table select... from Schema_Level_Table
    The PL/SQL equivalent would be
    select...
    bulk collect into Program_Variable_Collection
    from Schema_Level_Table
    The attached shows that once you have populated your collection, then you can then query it with regular SQL -- both from inside PL/SQL code and from naked SQL.
    and the code is here
    CONNECT System/p
    -- Drop and re-create "ordinary" user Usr
    EXECUTE d.u
    CONNECT Usr/p
    create table Schema_Things(ID number, Description Varchar2(80))
    create package Pkg is
    subtype Thing_t is Schema_Things%rowtype;
    type Things_t is table of Thing_t; -- index by pls_integer
    Things Things_t;
    -- PLS-00630: pipelined functions must have
    -- a supported collection return type
    -- for "type Things_t is table of Thing_t index by pls_integer".
    function Computed_Things return Things_t pipelined;
    procedure Insert_Schema_Things(No_Of_Rows in pls_integer);
    end Pkg;
    create package body Pkg is
    function Computed_Things return Things_t pipelined is
    Idx pls_integer;
    Thing Thing_t;
    begin
    Idx := Things.First();
    while Idx is not null loop
    pipe row (Things(Idx));
    Idx := Things.Next(Idx);
    end loop;
    end Computed_Things;
    procedure Insert_Schema_Things(No_Of_Rows in pls_integer) is
    begin
    Things := Things_t();
    Things.Extend(No_Of_Rows);
    for j in 1..No_Of_Rows loop
    Things(j).ID := j;
    Things(j).Description := To_Char(j, '00009');
    end loop;
    insert into Schema_Things
    select * from Table(Pkg.Computed_Things());
    end Insert_Schema_Things;
    end Pkg;
    -- Test 1.
    begin Pkg.Insert_Schema_Things(100); end;
    select * from Schema_Things
    -- Test 2.
    begin
    Pkg.Things := Pkg.Things_t();
    Pkg.Things.Extend(20);
    for j in 1..20 loop
    Pkg.Things(j).ID := j;
    Pkg.Things(j).Description := To_Char(j, '00009');
    end loop;
    for j in 1..5 loop
    Pkg.Things.Delete(5 +2*j);
    end loop;
    end;
    select * from Table(Pkg.Computed_Things())
    /

Maybe you are looking for

  • Guide to overcome hal.dll error - disk error & other errors.

    Okay to start off with - guide for installing bootcamp. DISCLAIMER: I take no responsibility at all - whatsoever for any damage the following steps cause to anything. If you follow this guide and then are annoyed at me in any way - don't be - you fol

  • Lock object is not working automatically

    Hi experts, i have a problem , A table is updated by a program which is used by multiple user . I have used lock function module 'ENQUEUE_E_TABLE ' and 'DEQUEUE_E_TABLE' for that . when updation section occurs first user which come first go through i

  • Reset Time Machine Password to Backup Using External Drive

    I have been using Time Machine to backup my files regularly on an External drive. I usually backup my files (using Backup Now option) and then turn off Time Machine. I have been doing this successfully for a month on my new MacBookPro (late 2013 vers

  • Create XML transformation in SAP R/3 4.7

    Hi Experts, Kindly let me know the transaction for creating xml transformation in sap r/3 4.7, if there is any. Though i could not find anything through tstc or se93. Is there any other way of creating xml transformation in r/3 4.7. There is a tcode

  • Exposure control effecting Lumiance

    Have others requested from Apple, that the Exposure slider effect lumiance only and not increase Saturation at the same time. Justs seems to me that exposure should be seperated from saturation especially since the Saturation slider is just below. I