Object tables and stored proecedures

I am trying to find something about retrieving data from object tables using functions/stored procedures. I have tried a couple of things but, my code throws an "illegal column datatype" error when I try to fill the dataset.
I am sure there is a way to do have a function or SP return object types to C# code, what ways work best?
Thanks in advance,

You could use a result set...I have done this using Pipelined functions that return a table of objects and used the Table() function to wrap the function return as a table in a select statement...
open cursor for select * from table(my_function)
where my_function returns a table of objects (see pipelined row functions).
You may be able to reference your object directly (Ref / Value) if it is a nested object.

Similar Messages

  • Migrate tables and stored proc from SQLServer 2005 Express to Oracle10G

    How to migrate tables and stored procedures from SQLServer 2005 Express to Oracle10G using SQLDeveloper? thank you very much

    Using Oracle SQL Developer Migration Workbench
    http://www.oracle.com/technology/tech/migration/workbench/index_sqldev_omwb.html

  • Object tables and procedures.

    Hi! I apologize in advance if my question is too trivial. I'm building simple object-relational database, and i would like to move a lot of my programming logic into database. I plan to build object tables based on object types that contain not only attributes but also functions and procedures. Now for example, i have object type "product" that contains some atributes like id ,name, price..., and let say procedure LowerThePrice(Percentage NUMBER) that should change the actual data.
    Now i create table Products of type product and fill it with some data. The question is how can i call/apply this procedure LowerThePrice on rows of products object table? If this scenario is even possible, how can i call that procedure using sql plus, and VB.net 2005 (i have installed and configured ODP.NET and oracle 11g).
    Thanks!

    1. Has been mentioned before - we do have a bug on it. To search across all your pl/sql, there is a report you can use.
    2. We are working on improving errors but I can't make any promises.
    3. We have heard this before but it won't be there for v1.0. You can use the Connections navigator to access the details of the objects that are accessible to you while you have a Worksheet open. You can even drag your Worksheet tab down to place it under the Connections details tab so you can see them both at the same time.
    4. In a post-v1.0 release, we will be looking at additional, alternate navigation.
    5. We have an open bug to not prompt you for the same bind more than once.
    6. I will talk to the Worksheet developer about this one. Not sure we can remember the binds from execution to execution but it would be a great enhancement.
    7. Not sure why this is failing - I will check into it.
    -- Sharon

  • Generating XML from relational tables and storing back in CLOB field

    I have been reviewing the documentation and trying to figure out the best approach. I am on v 10.2.0.3 and need to select from a parent table and three child tables and want to generate the results as xml that I will place in a clob field in another table. I looked at XMLQuery and dbms_xmlgen.getxml. The difference appears to be that getxml allows you to code traditional sql to join the tables.
    I would greatly appreciate it if someone could provide some feedback and any sample code along the line that I describe above.
    Thank you in advance for your help!
    Jerry

    Any feedback to the above questions would be greatly appreciated!

  • Object Tables and Relational Tables

    the statement below are they true for both Object and Relational tables?
    Rows are stored in extents
    can rows can be made up of one column
    collection types can be used in a column
    Thanks!

    >
    Rows are stored in extents
    >
    Yes - in the sense that rows are stored in 'blocks' and extents are comprised of one or more blocks. So since rows are in blocks and blocks are in extents then rows are in extents.
    >
    can rows can be made up of one column
    >
    Yes
    CREATE TABLE ONE_COLUMN_TABLE (NAME VARCHAR2(30));collection types can be used in a column
    >
    yes
    CREATE TYPE num_varray AS VARRAY(10) OF NUMBER(12, 2)
    CREATE TABLE varray_table (col1 num_varray)
    INSERT INTO varray_table VALUES (num_varray(100, 200))

  • PowerPivot tables and stored procedures

    What can I use to dynamically create a PowerPivot table in excel, using a stored procedure as a data source?
    Onyx12

    Hi there
    Thank you for your response.
    Here's what I'm trying to achieve and I stand under correction. I have a stored procedure which I want to mirror it's query result as a Pivot Table in Excel, and have done so by hard coding the execution code and imported it to Excel. But now I'm trying
    to find out if there is another way to do this, in Excel though. I've been looking at solutions which include building macros, but I'm afraid SSMS does not support them. And even so, I'm not sure if building a macro is an ideal solution in this case. In essence,
    I'm trying to retrieve data using a stored procedure, through the use of TSQL code in Excel. Please see query I've provided to Excel, using PowerPivot. I hope I've articulated myself thoroughly.
    DECLARE @RC int
    DECLARE @as_at_date datetime
    DECLARE @all_versions bit
    DECLARE @include_motor bit
    DECLARE @include_reserve bit
    -- TODO: Set parameter values here.
    SET @as_at_date = GETDATE()
    SET @all_versions  = 0
    SET @include_motor  = 0
    SET @include_reserve  = 0
    EXECUTE @RC = [dbo].[usp_claims_by_reserve] 
       @as_at_date
      ,@all_versions
      ,@include_motor
      ,@include_reserve
    Onyx12

  • Using REF with object table in SQL Developer

    When i create object tables and fill them with data, then in SQL Developer de REF value isn't displayed.
    I did the following:
    CREATE TYPE adres_type AS OBJECT
    (straat VARCHAR2(20)
    ,nummer VARCHAR2(10)
    ,postcode VARCHAR2(6)
    ,plaats VARCHAR2(50));
    CREATE TABLE adressen of adres_type;
    CREATE TYPE locatie_type AS OBJECT
    (nr NUMBER
    ,naam VARCHAR2(20)
    ,adres REF adres_type);
    CREATE TABLE locaties OF locatie_type;
    CREATE TABLE locaties OF locatie_type
    (SCOPE FOR (adres) IS adressen);
    insert into adressen values (adres_type('Arnhemsestraatweg', '33','6881ND','Velp'));
    insert into locaties values (1,'Directie', (select ref (a) from adressen a where a.plaats = 'Velp'))
    Then in SQL Developer de REF(A) column is empty, while in SQL*Plus it displays the REF value:
    In SQL Developer: SELECT a.*, REF(a) FROM adressen a;
    STRAAT NUMMER POSTCODE PLAATS REF(A)
    Arnhemsestraatweg 33 6881ND Velp
    In SQLPLUS: SELECT a.*, REF(a) FROM adressen a;
    STRAAT NUMMER POSTCODE PLAATS REF(A)
    Arnhemsestraatweg 33 6881ND Velp 0000280209C70341FBB96B4F77813B27B50E53BB4332382E22ADD64AD9B755F651D416B6DA010134
    Is this a bug or is there another reason why the ID doesnt display in SQL Developer.
    (this didnt work in all the previous SQL Developer releases and still not in de 2.1 E.A. version)

    Hi <not sure of your first name>,
    I have replicated the issues and logged a bug against this
    Bug 9102579 - FORUM: REF FUNCTION NOT RETURNING CORRECT RESULT
    Regards,
    Dermot O'Neill
    SQL Developer Team

  • How to insert subtype data from another table in  a object table ?

    Hi all
    I have been looking at the differences answers there are about insert data form a subtype in a object table of a supertype ,but have not found a solution yet.
    I hope you can help me.
    I my code Action_Logs is the object table and CloseStore_Logs_t is a subtype of Action_Logs_t
    My code is
    insert into Action_Logs(CloseStore_Logs_t (action_logs_id , physicalstores.physicalstores_id , brandedstores.BRANDEDSTORES_ID ,physicalstores.COMPANIES_ID ,brandedstores.CREATED_BY ,
    brandedstores.CREATED_DATE , brandedstores.DELETED ,brandedstores.CLOSED_DATE as brandedstore_closedate,
    physicalstores.CLOSED_DATE as physicalstore_closedate)
    select CloseStore_Logs_t((null as action_logs_id , physicalstores.physicalstores_id , brandedstores.BRANDEDSTORES_ID ,physicalstores.COMPANIES_ID ,brandedstores.CREATED_BY ,
    brandedstores.CREATED_DATE , brandedstores.DELETED ,brandedstores.CLOSED_DATE as brandedstore_closedate,
    physicalstores.CLOSED_DATE as physicalstore_closedate)
    from physicalstores , brandedstores ,companies
    where physicalstores.physicalstores_id = brandedStores.PHYSICALSTORES_ID and
    physicalstores.COMPANIES_ID = companies.COMPANIES_ID and
    brandedstores.closed_date is not null
    oracle gives a ora _917 fault about a missing comma , but I can not se what is wrong.
    I will be glad, if you can give me an example with a right syntax where a subtype is selected from other/s tables an inserted in table of its supertype.
    kinds regards
    steen ostersen

    Hi
    I see two problems with your statement:
    1) The utilization of the values clause is not permitted along with a subquery.
    2) The AS are not allowed.
    So, something like that should work:
    insert into Action_Logs
    select CloseStore_Logs_t(null,
    physicalstores.physicalstores_id,
    brandedstores.BRANDEDSTORES_ID,
    physicalstores.COMPANIES_ID,
    brandedstores.CREATED_BY,
    brandedstores.CREATED_DATE,
    brandedstores.DELETED,
    brandedstores.CLOSED_DATE,
    physicalstores.CLOSED_DATE)
    from physicalstores , brandedstores ,companies
    where physicalstores.physicalstores_id = brandedStores.PHYSICALSTORES_ID and
    physicalstores.COMPANIES_ID = companies.COMPANIES_ID and
    brandedstores.closed_date is not null
    HTH
    Chris

  • Object tables/associative arrays are using lots of memory what is alternate

    I'm using mostly object tables/associative arrays in my package and it is using lots of server memorey so i want to use a different technicque to save momorey .
    like using create global temporary table or nested Table Store as or creating table run time at the start and droping it in the end .
    do have any suggestion for this ?
    for this package i'm retriving data from different table into object tables and do calculation in memorey before i send data to front end for reporting using reference cursor .
    give me your suggetion or if you know any example code for this type of process using different technique please let us know .
    thank you very much
    regards
    shailen Patel

    You can create a global temporary table like this:
    CREATE GLOBAL TEMPORARY TABLE AR_TRIAL_RCPT(
      LOC_ACCT_ID NUMBER(12),  
      ACCT_ID NUMBER(12),  
      CURRENCY_ID NUMBER(12),  
      AMT NUMBER(13,   4),  
      AMT_PRIMARY NUMBER(13,   4)
    [ON COMMIT PRESERVE ROWS]
    ;If you want the table truncated on COMMITs leave out the part in brackets other wise leave off the brackets and the table won't be truncated until your session terminates or you explicitly truncate the table.
    You can also define indexes, primary keys, foreign keys, check constraints, etc. on your temporary table if need be to improve processing.
    Now when it comes to inserting into your newly minted global temporary table, you should be able to use one of insert statements from the following anonymous PL/SQL block:
    CREATE GLOBAL TEMPORARY TABLE AR_TRIAL_RCPT(
      LOC_ACCT_ID NUMBER(12),  
      ACCT_ID NUMBER(12),  
      CURRENCY_ID NUMBER(12),  
      AMT NUMBER(13,   4),  
      AMT_PRIMARY NUMBER(13,   4)
    --[ON COMMIT PRESERVE ROWS]
    CREATE GLOBAL succeeded.
    declare
    l_open_receipt_select_1 varchar2(4000) :=
        'select 1, 1, 1, 12.05, 12.05 from dual';
    l_open_receipt_select_2 varchar2(4000) :=
        'select 2, 2, 1, 17.05, 17.05 from dual';
    l_open_receipt_select_3 varchar2(4000) :=
        'select 3 loc_acct_id,
      1 currency_id,
      27.05 amt,
      3 acct_id,
      27.05 amt_primary
      from dual';
    l_open_receipt_select_4 varchar2(4000) :=
        'select 4 loc_acct_id,
      1 currency_id,
      24.35 amt,
      4 acct_id,
      24.35 amt_primary
      from dual';
    l_ins_stmt varchar2(4000);
    begin
      -- If the column order is known ahead of time and is consistent
      -- You can use this form:
      l_ins_stmt :=
        'insert into ar_trial_rcpt (
      loc_acct_id, acct_id, currency_id, amt, amt_primary
      ) '||l_open_receipt_select_1||
      ' union all '||
      l_open_receipt_select_2;
      execute immediate l_ins_stmt;
      -- If the column order is NOT known ahead of time or is INconsistent
      -- You can use this form:
      l_ins_stmt :=
        'insert into ar_trial_rcpt (
      loc_acct_id, acct_id, currency_id, amt, amt_primary
      select loc_acct_id
      , acct_id
      , currency_id
      , amt
      , amt_primary
      from ('||l_open_receipt_select_3||')
      union all
      select loc_acct_id
      , acct_id
      , currency_id
      , amt
      , amt_primary
      from ('||l_open_receipt_select_4||')';
      execute immediate l_ins_stmt;
    end;
    anonymous block completed
    select * from ar_trial_rcpt
    LOC_ACCT_ID ACCT_ID  CURRENCY_ID AMT    AMT_PRIMARY
    1           1        1           12.05  12.05      
    2           2        1           17.05  17.05      
    3           3        1           27.05  27.05      
    4           4        1           24.35  24.35      
    4 rows selected

  • Tables and Indices

    Hello,
    I check the current sizes of tablespaces in DB02.
    If I analyze the tablespace for whole ODS area
    (storage management: tablespaces) there
    are different types of database objects for example
    "TABLE", "INDEX", "TABLE PART" and "INDEX PART".
    My question is what are the database objects "Table Part"
    and "Index Part"? These objects allocate a lot of DB-memory. But they are not listed when I check the size of a single ODS object (detailed analysis, the size of a single ODS only results from the database objects "TABLE" and "INDEX").
    Best regards
    Mauricio

    Hi,
         Indexes are build on the Tables,Indices reduces the database accessing every time.By defualt one index(known as Primary Index)built on the table.Seconday index can be maintained by the user.In Primary index with Primary key by default index can be accessed.
                      To see the DBperformance Tcode used is DB02.
    Thanks,
    Praveena.

  • Storing XML using XSU, object VIEW and INSTEAD OF trigger

    Here is the point:
    I've got 2 tables which are linked:
    CREATE TABLE dept (
    deptno NUMBER PRIMARY KEY,
    deptname VARCHAR2(20)
    CREATE TABLE emp (
    empno NUMBER PRIMARY KEY,
    empname VARCHAR2(20),
    deptno NUMBER REFERENCES dept(deptno)
    I've got the following message, which I want to insert in the tables using XSU (I already have a PL/SQL stored procedure which work perfectly for insertion into 1 table, using DBMS_XMLSave.insertXML or xmlgen.insertXML):
    <DEPT>
    <DEPTNO>10</DEPTNO>
    <DEPTNAME>IT</DEPTNAME>
    <EMP>
         <EMPNO>1</EMPNO>
         <EMPNAME>John</EMPNAME>
    </EMP>
    <EMP>
         <EMPNO>1</EMPNO>
         <EMPNAME>Phil</EMPNAME>
    </EMP>
    </DEPT>
    So I've created the following object:
    CREATE TYPE emp_t AS OBJECT
    empno NUMBER,
    empname VARCHAR2(20)
    CREATE TYPE emplist_t AS TABLE OF emp_t;
    CREATE TYPE dept_t AS OBJECT
    deptno NUMBER,
    deptname VARCHAR2(20),
    emplist emplist_t
    Now I understand that I should create an object VIEW and an INSTEAD OF trigger (That's what I read many times),
    but I don't know how to structure the view and the trigger.
    Could you help? (Example of a similar context, piece of code)
    Thanks a lot
    Marion

    Hi John,
    I have exactly the same issue as you experienced back in January. I have a complex data modelling requirement which requires the need to pivot rows into columns using ROW_NUMBER() and PARTITION clauses. To hide the complexity from the middle tier, I have created a database view and appropriate INSTEAD OF triggers and mapped my EO to the view. I have overriden the lock() method on the EO implementation class (to avoid ORA-02014) and would like to try the same solution you used with the pl/sql call to lock the record.
    My question is, how did you manage the release of the lock if the transaction was not rolled back or committed by your application i.e. if the user closed the browser for instance.
    In my naivity, I would like to think that the BC4J framework would release any locks for the database session when it found the servlet session to be terminated however my concern is that the lock would persist and cause complications.
    Any assistance greatly appreciated (if you would be willing to supply your lock() method and pl/sql procedure logic I would be even more grateful!).
    Many thanks,
    Dave
    London

  • Require help on Array of Nested tables and Oracle Object type

    Hi All,
    I have a scenario where I have some millions of records received from a flat file and the record is stored in Table as below:
    Tablename: FILE_RECORD
    Rows:
    FILE_REG_ID = 1
    RECORD_NBR = 1     
    PROCESSED_IND = U
    RECORD= 00120130326006A
    FILE_REG_ID = 1
    RECORD_NBR = 2     
    PROCESSED_IND = U
    RECORD= 00120130326003
    1) I have to read these records at once and
    a) Split the RECORD column to get various other data Eg: Fld1=001, Fld2=20130326, Fld3 = 003
    b) send as an Array to Java.
    2) Java will format this into XML and sent to other application.
    3) The other application returns a response as Successful or Failure to Java in XML
    4) Java will send RECORD_NBR and the corresponding response as Success or Failure back to PLSQL
    5) PLSQL should match the RECORD_NBR and update the PROCESSED_IND = P.
    I 'm able to achieve this using SQL Table type by creating a TYPE for Each of the fields (Flds) however the problem is Java cannot Access the parameters as the TYPE are of COLUMN Types
    Eg: For RECORD_NBR
    SUBTYPE t_record_nbr IS FILE_RECORD.T010_RECORD_NBR%TYPE;
    Can you please let me know how I can achieve this to support Java, I know one way that is by creating an OBJECT TYPE and a TABLE of the OBJECT TYPE.
    Eg: T_FILE_RECORD_REC IS OBJECT
    FILE_REG_ID number(8), RECORD_NBR number (10), PROCESSED_IND varchar2(1), RECORD varchar(20)
    Create type T_FILE_RECORD_TAB IS TABLE OF T_FILE_RECORD_REC
    However I'm facing a problem to populate an Array of records, I know I'm missing something important. Hence please help.
    It would be helpful to provide some guidelines and suggestions or Pseudo or a Code to achieve this. Rest all I can take up further.
    Thanks in advance,

    I know once way that is creating a OBJECT TYPE and a TABLE of OBJECT TYPE, howeve I feel I'm missing something to achieve this.You're right, you need SQL object types created at the database level. Java doesn't know about locally defined PL/SQL types
    However you can do without all this by creating the XML directly in PL/SQL (steps 1+2) and passing the document to Java as XMLType or CLOB.
    Are you processing the records one at a time?

  • List tables and column names a stored procedure is querying

    Hello,
    Is there a way to list tables and column names that a stored procedure is querying, i.e, selecting from, using T-SQL?  If yes, is there a way to also show data types for the columns that a stored procedure is querying, i.e, selecting from?
    Thank you,  
    Lenfinkel

    One way to view the dependencies of an object is to use SSMS; navigate to the object, right click and select "view dependencies".  However this does not tell you what columns are being referenced by the Stored Procedure.
    One way to view what is being referenced by a stored procedure is to run something like
    select
    text
    from syscomments
    where
    id in
    (select id
    from sysobjects
    where
    name
    =[Your Object Name]
    And xtype
    in
    ('p','P')
    Please click "Mark As Answer" if my post helped. Tony C.

  • ADF table and ADF form on the same view object

    Hi,
    As per the ADF demos available on ADF site, I created a jsf page with 2 panels. One panel is an ADF table based on a view object. And the other panel is and ADF form based on the same view object. My requirement is that as I scroll through the records in the ADF table, the ADF Form should dynamically display the details of the record in the ADF table. My understanding is that this should be automatic. However, its not working as expected. What have I missed?

    Hi,
    Apply PPR for form that displays details.
    Like :
    <af:table id="t3">
    </af:table>
    <af:panelFormLayout id="pfl2" partialTriggers="t3">
    </af:panelFormLayout >

  • How to create a table and add columns to it with a stored procedure

    Hi,
    I hope that someone can help me.
    I want to create an empty table with the same columns as another
    table but with 4 columns more.
    So it's actualy a copy of a table but with 4 added columns.
    I have to do it in a stored procedure but I don't know which
    statements I have to use. I need to give 3 parameters : schema,
    table and prefix(e.g. the pers from column pers_number)
    Can someone help me?
    Thanks in advance, Ann

    you can !!
    here is some examples
    DECLARE
    sql_stmt VARCHAR2(200);
    plsql_block VARCHAR2(500);
    emp_id NUMBER(4) := 7566;
    salary NUMBER(7,2);
    dept_id NUMBER(2) := 50;
    dept_name VARCHAR2(14) := 'PERSONNEL';
    location VARCHAR2(13) := 'DALLAS';
    emp_rec emp%ROWTYPE;
    BEGIN
    EXECUTE IMMEDIATE 'CREATE TABLE bonus (id NUMBER, amt
    NUMBER)';
    sql_stmt := 'INSERT INTO dept VALUES (:1, :2, :3)';
    EXECUTE IMMEDIATE sql_stmt USING dept_id, dept_name, location;
    sql_stmt := 'SELECT * FROM emp WHERE empno = :id';
    EXECUTE IMMEDIATE sql_stmt INTO emp_rec USING emp_id;
    plsql_block := 'BEGIN emp_pkg.raise_salary(:id, :amt); END;';
    EXECUTE IMMEDIATE plsql_block USING 7788, 500;
    sql_stmt := 'UPDATE emp SET sal = 2000 WHERE empno = :1
    RETURNING sal INTO :2';
    EXECUTE IMMEDIATE sql_stmt USING emp_id RETURNING INTO salary;
    EXECUTE IMMEDIATE 'DELETE FROM dept WHERE deptno = :num'
    USING dept_id;
    EXECUTE IMMEDIATE 'ALTER SESSION SET SQL_TRACE TRUE';
    END;

Maybe you are looking for

  • Can't detect my wireless network

    Hi, A few days a go I started having problems with my Wirless connection. My Macbook Pro can seem to find it anymore. It can be gone for a week, and then out of nowhere it pops up again and works for a day or two. My iPhone connects fine to the netwo

  • HT4623 how do i get my contacts back on my  laptop

    how do i get my contacts back on my  laptop? I lost my iphone 3gs. so i kave new one.

  • Iphone not showing up in computer

    I'm trying to download a couple of pictures and my iphone will not show up on My Computer as a drive like it used to...help please?

  • How to stop the guesswork with printing business cards

    Hello everyone, when I print business cards I use one of those 10 blank business cards per sheet paper. I scan the image of the blank business card template, then I import to Illustrator and then I make the business cards. The problem is when I print

  • Tricky little JScrollPane problem

    I have a JScrollPane that contains a JPanel with BorderLayout called "mainPanel". I have a kind of web appearance with a left child panel of vertical JLabels, a north child panel for title, and a center child panel as a work area inserted into "mainP