Converting OBJECT Type into RECORD Type

folks,
Is there a way to Convert a OBJECT Type into a RECORD Type in Oracle PL/SQL, Because i have a stored procedure with RECORD Type as a IN parameter and as we know that we JDBC doesn't support calling or returning RECORD Types , So i was thinking of sending a OBJECT type and convert that to a RECORD type,
I appreciate any help with the code or point to the documentation,
thanks
KM

folks,
Is there a way to Convert a OBJECT Type into a RECORD Type in Oracle PL/SQL, Because i have a stored procedure with RECORD Type as a IN parameter and as we know that we JDBC doesn't support calling or returning RECORD Types , So i was thinking of sending a OBJECT type and convert that to a RECORD type,
I appreciate any help with the code or point to the documentation,
thanks
KM

Similar Messages

  • How to convert object type to only Date type ?

    Hii everyone,
    I have a table in database and their is column called as date and its data type is DateTime
    In my UI part i have taken a Datepeacker and what ever user selected that date i am storing in my Date properties which has the same data type DateTime and at the Insertion time the date inserting successfully but at the time of updating data i am getting
    error that the Date is not correct format because in date property it having the value 23:12:2014 00:00:00 which is crate problem at the time of update. So how to solve this ?
    Note : I am using VS2008 and using Datagrid inside datgrid what ever changes user make tat one i required to update ,below are my update code which done through datatable i.e
      first i have done datatable dt=new datatable();
                                  dt = EmpBusinessLayer.SelectManager(dd.Eno)
    then my update logic is :
        for (int i= 0; i < dt.Rows.Count; i++)
                    ee.Ename = dt.Rows[i][0].ToString();
                    ee.Job = dt.Rows[i][1].ToString();
                    ee.Dept = dt.Rows[i][2].ToString();
                    ee.Gender = dt.Rows[i][3].ToString();
                    ee.Status =Convert.ToInt32(dt.Rows[i][4]);
                    ee.Dates = Convert.ToDateTime(dt.Rows[i][6]);// Hear i am getting value like 23.8.2104 00:00:00
                    ee.Eno = Convert.ToInt32(dt.Rows[i][9]);
                    cmd = new SqlCommand("update Employee set sEname='"+ee.Ename+"', sEJob='"+ee.Job+"', sEDept='"+ee.Dept+"',
    sGender='"+ee.Gender+"', bStatus="+ee.Status+", dDates="+ee.Dates+" where iEmpNo="+ee.Eno, con);       // Hear Getting Error tat incorrect syntax 00
                    if (con.State != ConnectionState.Open)
                        con.Open();
                    if (cmd.ExecuteNonQuery() > 0)
                        return 1;
    S.K Nayak

    You could use the yyyy-MM-dd format by calling the ToString method on the DateTime object:
    cmd = new SqlCommand("update Employee set sEname='"+ee.Ename+"', sEJob='"+ee.Job+"', sEDept='"+ee.Dept+"', sGender='"+ee.Gender+"', bStatus="+ee.Status+", dDates=" + ee.Dates.ToString("yyyy-MM-dd") +" where iEmpNo="+ee.Eno, con);
    Note that you should use parameters when create a command like this though:
    https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlparametercollection.addwithvalue(v=vs.110).aspx
    But that's another story for another thread in another forum.
    Please remember to close your threads by marking helpful posts as answer and then start a new thread if you have a new question.

  • Converting object wrapper type array into equivalent primary type array

    Hi All!
    My question is how to convert object wrapper type array into equivalent prime type array, e.g. Integer[] -> int[] or Float[] -> float[] etc.
    Is sound like a trivial task however the problem is that I do not know the type I work with. To understand what I mean, please read the following code -
    //Method signature
    Object createArray( Class clazz, String value ) throws Exception;
    //and usage should be as follows:
    Object arr = createArray( Integer.class, "2%%3%%4" );
    //"arr" will be passed as a parameter of a method again via reflection
    public void compute( Object... args ) {
        a = (int[])args[0];
    //or
    Object arr = createArray( Double.class, "2%%3%%4" );
    public void compute( Object... args ) {
        b = (double[])args[0];
    //and the method implementation -
    Object createArray( Class clazz, String value ) throws Exception {
         String[] split = value.split( "%%" );
         //create array, e.g. Integer[] or Double[] etc.
         Object[] o = (Object[])Array.newInstance( clazz, split.length );
         //fill the array with parsed values, on parse error exception will be thrown
         for (int i = 0; i < split.length; i++) {
              Method meth = clazz.getMethod( "valueOf", new Class[]{ String.class });
              o[i] = meth.invoke( null, new Object[]{ split[i] });
         //here convert Object[] to Object of type int[] or double[] etc...
         /* and return that object*/
         //NB!!! I want to avoid the following code:
         if( o instanceof Integer[] ) {
              int[] ar = new int[o.length];
              for (int i = 0; i < o.length; i++) {
                   ar[i] = (Integer)o;
              return ar;
         } else if( o instanceof Double[] ) {
         //...repeat "else if" for all primary types... :(
         return null;
    Unfortunately I was unable to find any useful method in Java API (I work with 1.5).
    Did I make myself clear? :)
    Thanks in advance,
    Pavel Grigorenko

    I think I've found the answer myself ;-)
    Never thought I could use something like int.class or double.class,
    so the next statement holds int[] q = (int[])Array.newInstance( int.class, 2 );
    and the easy solution is the following -
    Object primeArray = Array.newInstance( token.getPrimeClass(), split.length );
    for (int j = 0; j < split.length; j++) {
         Method meth = clazz.getMethod( "valueOf", new Class[]{ String.class });
         Object val = meth.invoke( null, new Object[]{ split[j] });
         Array.set( primeArray, j, val );
    }where "token.getPrimeClass()" return appropriate Class, i.e. int.class, float.class etc.

  • Fetch into object type

    Oracle 10.2.0.5.0
    Using Pl/SQL Developer
    Hi I'm new to collections, object types etc, so I aologize for any poor wording and missed concepts...
    I need to output a ref cursor from my package (for a summary report in SQL Server Reporting Services 2005). The summary report has two fields that come from the database table and 5 calculated fields. My idea for creating the ref cursor is as follows:
    1. Define an object type at the schema level
    2. Define a table (collection) type at the schema level
    3. Define a ref cursor at the package level
    4. Using dynamic SQL create a sql statement creating virtual columns for the 5 calculated fields
    5. Fetch cursor with dynamic sql into object type one record at a time
    6. Calculate the other five field values and update the object for each record processed
    7. Add the object 'record' to the table (collection) after each record is processed
    8. After the fetch is complete, convert the table to a ref cursor for returning to my application
    Here is what I have so far. I have cut out several of the calculated fields for simplicities sake. It is not complete and I don't know how to fetch the database row into the object, nor convert the collection to a ref cursor.
    Any help would be greatly appreciated.
    create or replace type dlyout.srvCtr_sum_rec_type as object (
                               zoneNo number,
                               zonetx varchar2(15),
                               distNo varchar2(4),
                               distTx varchar2(30),
                               numOccr number,
                               MEError varchar2(1));
    create or replace type dlyout.srvCtr_sum_tbl_of_recs is table of srvCtr_sum_rec_type;
    CREATE OR REPLACE PACKAGE DLYOUT.REPORTS_PKG is
      TYPE CUR IS REF CURSOR; 
    PROCEDURE testABC(startDate IN date,
                           endDate IN date,
                           startTime IN varchar2,
                           endTime IN varchar2,
                           zoneNo IN dlyout.loc.zone_no%type,
                           distNo IN dlyout.loc.dist_cd%type,
                           CUROUT OUT CUR);
    END;
    CREATE OR REPLACE PACKAGE BODY DLYOUT.REPORTS_PKG IS
      PROCEDURE testABC(startDate IN date,
                           endDate IN date,
                           startTime IN varchar2,
                           endTime IN varchar2,
                           zoneNo IN dlyout.loc.zone_no%type,
                           distNo IN dlyout.loc.dist_cd%type,
                           CUROUT OUT CUR) as
      startDateTimeStr varchar2(10) := to_Char(startDate, 'MM/DD/YYYY') ;     
      endDateTimeStr varchar2(10) := to_Char(endDate, 'MM/DD/YYYY');   
      startDateTime date := to_date(startDateTimeStr || ' ' || startTime, 'MM/DD/YYYY HH24:MI:SS');
      endDateTime date := to_date(endDateTimeStr|| ' ' || endTime, 'MM/DD/YYYY HH24:MI:SS');
      distClause varchar2(1000);
      sqls varchar2(2000);
      zoneClause varchar2(1000) :='';
      idx number :=0;
      curSrvCtr cur;
      srvCtrRec srvCtr_sum_rec_type;
      srvCtrTbl srvCtr_sum_tbl_of_recs :=srvCtr_sum_tbl_of_recs();
      BEGIN
        if zoneNo <> 9999 then
            zoneClause := ' and zone_no member of dlyout.reports_common_stuff_pkg.convert_to_collection(zoneNo)';
        end if;
        if distNo <> '9999' then
            distClause := ' and dist_cd member of dlyout.reports_common_stuff_pkg.convert_to_collection(distNo) ';
        end if;
        sqls := 'select distinct l.zone_no zoneNo, l.zone_tx zoneTx,
                l.dist_cd distCd , l.dist_tx distTx, 0 numOccr, '''' MEError       
                from dlyout.loc l
                where l.ts between  :startts and :endts ' ||
                zoneClause ||
                distClause ||
                ' order by l.zone_no, l.dist_tx ';
        open curSrvCtr for sqls using  startDateTime, endDateTime;
        LOOP
          FETCH curSrvCtr INTO srvCtrRec;      --ORA:00932 inconsistent datatype expected - got -
          EXIT WHEN curSrvCtr%NOTFOUND;
            --call other functions to get calculated fields
            srvCtrRec.numOccr := dlyout.reports_common_stuff_pkg.Num_Loc_Exc_Mom(startDateTimeStr, endDateTimeStr, starttime, endTime, srvctrRec.distno);
            srvCtrRec.MEError := dlyout.reports_common_stuff_pkg.ME_Error(startDateTimeStr, endDateTimeStr, starttime, endTime, srvCtrRec.distNo, null);
            dbms_output.put_line(srvCtrRec.distTx || ' ' || srvCtrRec.numoccr|| ' ' || srvCtrRec.MEError);
         end loop;
    end testABC;
    END;
      Then I need to add the object to the table. Something like this?
           -- add object 'record' to table
           srvCtrTbl.extend;
           srvCtrTbl.last := srvCtrRec;
    Then I am not sure how to do the cast to get the table to a ref cursor. Something like this?
    open curout for SELECT *
    FROM TABLE (CAST (srvCtrTbl AS srvCtr_sum_tbl_of_recs))
    ORDER BY zoneNo, distTx;

    Ok, so after more research if seems that in 10.2 you cannot assign an object (SQL) type to a ref cursor (PLSQL). SO i changed my direction and used a global temp table - created at the schema level.
    Create global temporary table dlyout.srvCtr_summary (
                               zoneNo number,
                               zonetx varchar2(15),
                               distNo varchar2(4),
                               distTx varchar2(30),
                               numOccr number,
                               MEError varchar2(1)
    ) on commit delete rows;Here is what the procedure looks like now.
    PROCEDURE testABC(startDate IN date,
                           endDate IN date,
                           startTime IN varchar2,
                           endTime IN varchar2,
                           zoneNo IN dlyout.location.zone_no%type,
                           distNo IN dlyout.location.dist_cd%type,
                           CUROUT OUT CUR) as
      startDateTimeStr varchar2(10) := to_Char(startDate, 'MM/DD/YYYY') ;     
      endDateTimeStr varchar2(10) := to_Char(endDate, 'MM/DD/YYYY');   
      startDateTime date := to_date(startDateTimeStr || ' ' || startTime, 'MM/DD/YYYY HH24:MI:SS');
      endDateTime date := to_date(endDateTimeStr|| ' ' || endTime, 'MM/DD/YYYY HH24:MI:SS');
      distClause varchar2(1000);
      sqls varchar2(2000);
      zoneClause varchar2(1000) :='';
      curSrvCtr cur;
    --Still need the PLSQL record type to put in the cursor for the dynamic SQL
    type srvCtr_sum_rec_type is record (zoneNo dlyout.location.zone_no%type,
                               zonetx dlyout.location.zone_tx%type,
                               distNo dlyout.location.dist_cd%type,
                               distTx dlyout.location.dist_tx%type,
                               numOccr number,
                               MEError varchar2(1));
      srvCtrRec srvCtr_sum_rec_type;
      BEGIN
        --create clauses for dynamic sql by calling other functions
        if zoneNo <> 9999 then
            zoneClause := ' and zone_no member of dlyout.reports_common_stuff_pkg.convert_to_collection(zoneNo)';
        end if;
        if distNo <> '9999' then
            distClause := ' and dist_cd member of dlyout.reports_common_stuff_pkg.convert_to_collection(distNo) ';
        end if;
        --here is the dynamic sql
        sqls := 'select distinct l.zone_no, l.zone_tx,
                l.dist_cd , l.dist_tx, 0, 0,
                0, 0, ''''       
                from dlyout.location l
                where l.enrgz_ts between  :startts and :endts ' ||
                zoneClause ||
                distClause ||
                ' order by l.zone_no, l.dist_tx ';
       open curSrvCtr for sqls using  startDateTime, endDateTime;
        LOOP
          --fetch in part of the record
          FETCH curSrvCtr INTO srvCtrRec;
          EXIT WHEN curSrvCtr%NOTFOUND;
          --do the calculations to get the other field values
            srvCtrRec.numOccr := dlyout.reports_common_stuff_pkg.Num_Loc_Exc_Mom(startDateTimeStr, endDateTimeStr, starttime, endTime, srvctrRec.distno);
             srvCtrRec.MEError := dlyout.reports_common_stuff_pkg.MEC_Error(startDateTimeStr, endDateTimeStr, starttime, endTime, srvCtrRec.distNo, null);
            dbms_output.put_line(srvCtrRec.distTx || ' ' || srvCtrRec.numoccr|| ' ' || srvCtrRec.MEError);
            --add record to GTT
            insert into dlyout.srvCtr_summary(zoneNo, zoneTx, distNo, distTX, numOccr, MEError )
            values(srvCtrRec.zoneNo, srvCtrRec.zoneTx, srvCtrRec.distNo, srvCtrRec.distTX, srvCtrRec.numOccr, srvCtrRec.MEError);
        end loop;
       --open GTT and return ref cursor to app
       open curout for SELECT *
           FROM srvCtr_summary
           ORDER BY zoneNo, distTx;
      end testABC;

  • Use TYPE RECORD or Create Object TYPE to build Collection?

    Hi All,
    I need to pull in data from our ERP system via a DB Link to keep some of our Web Data up to date. I wasn't sure if I should pull the data into my collection by creating a TYPE RECORD or Creating an Object Type and fillng it that way. Is there a preferrable method?
    Record:
    TYPE ItemInventory IS RECORD (
    ProductID Products.ProductID%TYPE,
    Qty Products.QTY%TYPE);
    Object:
    Create Type ProdObj as Object(
    ProductID Products.ProductID%TYPE,
    QTY Products.QTY%TYPE);
    Maybe both are suitable....wasn't sure.
    Any suggestions/info is greatly apprecaited.
    S
    Edited by: ScarpacciOne on Feb 21, 2010 7:54 PM

    ScarpacciOne wrote:
    We have a complex view we use from our ERP system that allows us to pull all of our available inventory and update our website with that information. What I was thinking I would do is refactor the current procedures that are in place to update this information and pull that views information into a collection so that I could speed up the update process.The basic difference between the two is that one is a dumb record structure (similar to a C struct), whereas the other is an intelligent class (similar to a class definition in Java/C++). It can have methods and constructors.
    The next major difference is that one can only be use in the PL language and not in SQL. The record struct is a PL data type definition. PL cannot provide SQL engine support for it.
    On the other hand, the SQL type definition is supported by both the PL and SQL languages. This allows the type to be transparently used in both languages.
    I usually prefer the SQL type definition approach in general, as it allows for more flexibility.
    However, for pure collection processing in PL/SQL, there's very little to choose between the two approaches as they serve the exact same purpose - increasing performance by decreasing context switching between the PL and SQL engines.
    So you need to look beyond mere bulk collection and bulk processing to decide on which approach to use. For example, a SQL type definition allows for a standard SQL projection from cursors, enabling PL/SQL code to be cursor agnostic (as each cursor, irrespective of the table(s) queried, returns the same object type). However, if the aim is simply to bulk collect from that specific cursor, then it is a lot simpler to use a PL record struct.

  • Invoke Web service - WSDL error "Object of type 'System.Int32' cannot be converted to type 'System.UInt64'."

    Hello,
    I'm having a problem when I try to load the WSDL file for the "Invoke Web Service" activity.
    I'm trying to create a connection between Orchestrator 2012 R2 and Cisco Unified CM through a Web Services. When I click the WSDL file and I click the "Format Hint" button appears the following error "Object of type 'System.Int32' can not be
    converted to type 'System.UInt64'."
    The WSDL file that Cisco Unified CM I exported another work tools, tested and working well. In Orchestrator just gives the error.
    Can anyone help with this?
    Thank you
    Rui

    Hi,
    You're going to have to use Get-AzureVM to get your specific VM object and then pipe it into Add-AzureDataDisk. See the examples here:
    http://msdn.microsoft.com/en-us/library/windowsazure/dn495298.aspx
    Don't retire TechNet! -
    (Don't give up yet - 12,575+ strong and growing)

  • Trying to drag pdf files i have and combine them into one pdf file in the account i just purchased with Adobe. when i drag a pdf file over Adobe doesn't accept it. says it can not convert this type of file. but it is an Adobe file. Do I need to change it?

    Trying to drag pdf files i have and combine them into one pdf file in the account i just purchased with Adobe. when i drag a pdf file over Adobe doesn't accept it. says it can not convert this type of file. but it is an Adobe file. Do I need to change it in some other form befor dragging it?

    Hello djensen1x,
    Could you please let me know what version of Acrobat are you using.
    Also, tell me your workflow of combining those PDF files?
    Please share the screenshot of the error message that you get.
    Hope to get your response.
    Regards,
    Anubha

  • "Property value is not valid" when PropertyGridView tries to convert a string to a custom object type.

    Hi,
    I have a problem with an PropertyGrid enum property that uses a type converter.
    In general it works, but when I double clicking or using the scoll wheel,  an error message appears:
    "Property value is not valid"
    Details: "Object of type 'System.String' cannot be converted to type 'myCompany.myProject.CC_myCustomProperty."
    I noticed that the CommitValue method (in PropertyGridView.cs) tries to convert a string value to a CC_myCustomProperty object.
    Here is the code that causes the error (see line 33):
    (Using the .net symbols from the PropertyGridView.cs file)
    1
            internal bool CommitValue(GridEntry ipeCur, object value) {   
    2
    3
                Debug.WriteLineIf(CompModSwitches.DebugGridView.TraceVerbose,  "PropertyGridView:CommitValue(" + (value==null ? "null" :value.ToString()) + ")");   
    4
    5
                int propCount = ipeCur.ChildCount;  
    6
                bool capture = Edit.HookMouseDown;  
    7
                object originalValue = null;   
    8
    9
                try {   
    10
                    originalValue = ipeCur.PropertyValue;   
    11
    12
                catch {   
    13
                    // if the getter is failing, we still want to let  
    14
                    // the set happen.  
    15
    16
    17
                try {  
    18
                    try {   
    19
                        SetFlag(FlagInPropertySet, true);   
    20
    21
                        //if this propentry is enumerable, then once a value is selected from the editor,   
    22
                        //we'll want to close the drop down (like true/false).  Otherwise, if we're  
    23
                        //working with Anchor for ex., then we should be able to select different values  
    24
                        //from the editor, without having it close every time.  
    25
                        if (ipeCur != null &&   
    26
                            ipeCur.Enumerable) {  
    27
                               CloseDropDown();   
    28
    29
    30
                        try {   
    31
                            Edit.DisableMouseHook = true;  
    32
    /*** This Step fails because the commit method is trying to convert a string to myCustom objet ***/ 
    33
                            ipeCur.PropertyValue = value;   
    34
    35
                        finally {   
    36
                            Edit.DisableMouseHook = false;  
    37
                            Edit.HookMouseDown = capture;   
    38
    39
    40
                    catch (Exception ex) {   
    41
                        SetCommitError(ERROR_THROWN);  
    42
                        ShowInvalidMessage(ipeCur.PropertyLabel, value, ex);  
    43
                        return false;  
    44
    I'm stuck.
    I was wondering is there a way to work around this? Maybe extend the string converter class to accept this?
    Thanks in advance,
    Eric

     
    Hi,
    Thank you for your post!  I would suggest posting your question in one of the MS Forums,
     MSDN Forums » Windows Forms » Windows Forms General
     located here:http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=8&SiteID=1.
    Have a great day!

  • Instantiate com.waveset.object.Type into Type[]

    I am trying to instantiate com.waveset.object.Type into Type[]. I am trying execute method exportObjects(Type[] types, java.lang.String filename, BulkMonitor monitor). I can write it in java doing something like _wsSess.exportObjects(new Type[]{Type.findType(type)}, out, null); but having trouble doing in xpress or javascript. Please help. Thanks.

    Hi,
    To get all the types, you can use:
    <invoke name='getTypes' class='com.waveset.object.Type'/>
    to get specific ones:
    <block>
    <set name='typeList'>
    <list>
    <invoke name='getType' class='com.waveset.object.Type'>
    <s>Resource</s>
    </invoke>
    <invoke name='getType' class='com.waveset.object.Type'>
    <s>User</s>
    </invoke>
    </list>
    </set>
    <invoke name='toArray'>
    <ref>typeList</ref>
    </invoke>
    </block>
    hope this helps
    Regards
    Arjun

  • JPublisher: oracle...literal.AttributeMap not translated into object type

    Hi,
    I have a problem to get a valid PL/SQL wrapper for the web-service at http://adostest.armstrongconsulting.com/DSX/DocumentServices.asmx?wsdl
    I use jpub to generate the web service callout (jar file and pl/sql wrapper) and the generation of that file completes without an error, but if I try to load the pl/sql package into the database it fails, because one of the generated object types has an invalid definition.
    -- Create SQL type for oracle.j2ee.ws.common.encoding.literal.AttributeMap
    CREATE OR REPLACE TYPE OBJ_AttributeMap AS OBJECT (); The object type for the java class oracle.j2ee.ws.common.encoding.literal.AttributeMap doesn't contain any attributes.
    Software used:
    -) Latest JPublisher 10g Release 10.2 (http://download.oracle.com/otn/utilities_drivers/jdbc/10201/jpub_102.zip)
    -) 10.1.3.1 Callout Utility for 10g and 11g RDBMS (http://download.oracle.com/technology/sample_code/tech/java/jsp/dbws-callout-utility-10131.zip)
    -) Oracle DB 10.2.0.3
    Command used to generate files:
    jpub -proxywsdl="http://adostest.armstrongconsulting.com/DSX/DocumentServices.asmx?wsdl" -proxyopts=noload -package=ados -plsqlpackage=ADOS_WebServiceBTW, I noticed that the dbwsa.jar contains this class, but the "runtime" classes contained in dbwsclientws.jar which are loaded into the database do not contain this class. If I look into the previous version of the Callout Utility (10.1.3.0) at http://download.oracle.com/technology/sample_code/tech/java/jsp/dbws-callout-utility-10R2.zip it is contained in the dbwsclient.jar which is loaded into the database.
    What is wrong or what can I do to get a valid object type mapping?
    Thanks
    Patrick

    Yes. We are calling a .NET web service as well.
    I got around the problem by the following steps:
    1. Forcing JPub to use the jar files that come with JDeveloper 10.1.3.3, rather than dbwsa.jar and dbwsclientws.jar.
    2. Upload the JDeveloper 10.1.3.3 web service libraries into the database
    3. Manually edit the JPub wrapper code (static methods) generated by JPub. I have to comment out all references to AttributeMap. Not sure why JPub wants to use it...

  • Help in using record type and object type

    Hi Experts,
    I am new to object types and record types.
    I want to return the output of this query using one OUT parameter
    from the procedure using RECORD type or OBJECT type.
    with out using refcursor.
    SELECT empno,ename,sal FROM emp WHERE deptno=30;
    Let us assume the query is returning 50 records.
    I want to send those 50 records to OUT parameter using record type or object type.
    Please provide the for the requirement code using RECORD TYPE and OBJECT TYPE separately.
    Your earliest response is appreciated.
    Thanks in advance.

    Hi All,
    I have tried this.But it ising not work
    CREATE OR REPLACE PACKAGE maultiplevalues_pkg
    IS
    TYPE t_record IS RECORD
    (empno emp.empno%TYPE,
    ename emp.ename%TYPE,
    sal emp.sal%TYPE);
    V_RECORD t_record;
    TYPE t_type IS TABLE OF V_RECORD%TYPE;
    PROCEDURE maultiplevalues_pROC(p_deptno IN emp.deptno%TYPE,
    dept_result OUT t_type);
    END;
    CREATE OR REPLACE PACKAGE body maultiplevalues_pkg
    IS
    PROCEDURE maultiplevalues_pROC(p_deptno IN emp.deptno%TYPE,
    dept_result OUT t_type)
    is
    begin
    dept_result :=t_type();
    for I in(
    select EMPNO,ENAME,SAL from EMP WHERE deptno=p_deptno
    LOOP
    dept_result.extend;
    dept_result(i).empno :=i.empno;
    dept_result(i).ename :=i.ename;
    dept_result(i).sal :=i.sal;
    END LOOP;
    END;
    END;
    Please help me OUT return multiple values through single OUT variable in a procedure.
    Thanks.

  • Convert Object return type columns

    Hi Team
    Hi,
    I have created a object type as
    create type emp_obj_dtl as OBJECT (ename varchar2(50),mgr NUMBER)
    create type emp_dtl_obj_typ as TABLE of emp_obj_dtl
    Using the these object i have created on function as
    CREATE OR REPLACE FUNCTION emp_test_func (peno NUMBER)
    RETURN emp_dtl_obj_typ
    AS
    lv_emp_dtl emp_dtl_obj_typ := emp_dtl_obj_typ ();
    BEGIN
    SELECT emp_dtl_obj_typ(emp_obj_dtl (ename, mgr))
    INTO lv_emp_dtl
    FROM emp
    WHERE empno = peno;
    RETURN lv_emp_dtl;
    END;
    Now if i am executig query as
    SELECT empno, emp_test_func (empno) emp_dtls
    FROM emp
    It is returning me the data as
    EMPNO | EMP_DTLS
    7500 | (DATASET)
    7382 | (DATASET)
    7569 | (DATASET)
    7800 | (DATASET)
    But I want the result set as
    EMPNO | ENAME | MGR
    7500 | SMITH | 7863
    7382 | JAMES | 7896
    7569 | KING | 7856
    7800 | SANGR | 7456
    Appricate your help to get the resultset as above.
    thank you & Rgrds
    VIKAS ARORA

    Don't really like the approach you've used in your sample code - in effect, that is caching SQL data using very expensive PL memory (called PGA). It is wrong for performance reasons. It is wrong for scalability reasons.
    It is returning me the data as
    EMPNO | EMP_DTLS
    7500 | (DATASET)Correct. As the dataset is not a scalar data type like varchar2, date or number, but a complex object type. And not just a object type, but a collection (table) object type.
    You need to decide how you want to treat that object data that the SQL projection returns.
    Here's a more comprehensive example:
    SQL> create or replace type TPerson as object (ename varchar2(50), empno number );
      2  /                                                                           
    Type created.
    SQL>           
    SQL> create or replace type TDirectReports as table of TPerson;
      2  /                                                        
    Type created.
    SQL>           
    SQL> create or replace function DirectReports( manager number ) return TDirectReports as
      2  -- returns list of employees that directly reports to manager                     
      3          list    TDirectReports;                                                   
      4  begin                                                                             
      5          select                                                                    
      6                  TPerson( InitCap(e.ename), e.empno ) bulk collect into list       
      7          from    emp e                                                             
      8          where   e.mgr = manager                                                   
      9          order by ename;                                                           
    10                                                                                    
    11          return( list );                                                           
    12  end;                                                                              
    13  /                                                                                 
    Function created.
    SQL>
    SQL> col ENAME format a10
    SQL> col DIRECT_REPORTS format a100
    SQL> select ename, DirectReports(empno) as "DIRECT_REPORTS" from emp;
    ENAME      DIRECT_REPORTS(ENAME, EMPNO)
    SMITH      TDIRECTREPORTS()                                                                                   
    ALLEN      TDIRECTREPORTS()                                                                                   
    WARD       TDIRECTREPORTS()                                                                                   
    JONES      TDIRECTREPORTS(TPERSON('Ford', 7902), TPERSON('Scott', 7788))                                      
    MARTIN     TDIRECTREPORTS()                                                                                   
    BLAKE      TDIRECTREPORTS(TPERSON('Allen', 7499), TPERSON('James', 7900), TPERSON('Martin', 7654), TPERSON('Tur
               ner', 7844), TPERSON('Ward', 7521))                                                                
    CLARK      TDIRECTREPORTS(TPERSON('Miller', 7934))
    SCOTT      TDIRECTREPORTS(TPERSON('Adams', 7876))
    KING       TDIRECTREPORTS(TPERSON('Blake', 7698), TPERSON('Clark', 7782), TPERSON('Jones', 7566))
    TURNER     TDIRECTREPORTS()                                                                     
    ADAMS      TDIRECTREPORTS()                                                                     
    JAMES      TDIRECTREPORTS()                                                                     
    FORD       TDIRECTREPORTS(TPERSON('Smith', 7369))                                               
    MILLER     TDIRECTREPORTS()
    14 rows selected.Note that the dataset is a collection object - that contains zero or more nested objects. In this case, a list of employees that directly reports to the current employee.
    How can we use this collection object? Here is a basic example:
    SQL> col 1ST_EMPLOYEE format a15
    SQL> with MANAGER_LIST as(
      2          select ename, DirectReports(empno) as "DIRECT_REPORTS" from emp
      3  )
      4  select
      5          l.ename,
      6          (select count(*) from TABLE(l.direct_reports)) as "NO_OF_EMPLOYEES",
      7          (select d.ename from TABLE(l.direct_reports) d where rownum = 1) as "1ST_EMPLOYEE",
      8          (select max(d.empno) from TABLE(l.direct_reports) d ) as "LAST_EMPLOYEE"
      9  from       manager_list l
    10  /
    ENAME      NO_OF_EMPLOYEES 1ST_EMPLOYEE    LAST_EMPLOYEE
    SMITH                    0
    ALLEN                    0
    WARD                     0
    JONES                    2 Ford                     7902
    MARTIN                   0
    BLAKE                    5 Allen                    7900
    CLARK                    1 Miller                   7934
    SCOTT                    1 Adams                    7876
    KING                     3 Blake                    7782
    TURNER                   0
    ADAMS                    0
    JAMES                    0
    FORD                     1 Smith                    7369
    MILLER                   0
    14 rows selected.Just note that this example merely illustrates how to use and reference objects in SQL. This is not the preferred way to address the problem it does - as the same could have been a lot easier achieved using a simple self-join.
    So make sure that when you use objects in SQL, it is for the right technical reasons.

  • How to Convert OBJECT_TYPE to the Object Type Used for DBMS_METADATA?

    How do you convert the object type in ALL_OBJECTS to the object type that DBMA_METADATA.GET_DDL expects?
    Thanks,
    Kurz

    maybe one needs to find a mapping between sys.metaview$ and all_objects:
    SQL> select type, xmltag, udt, viewname from sys.metaview$ where type like '%PACKAGE%'
    TYPE                      XMLTAG                    UDT                       VIEWNAME                
    DE_S_PACKAGE                                                                                          
    DE_S_COMP_PACKAGE                                                                                     
    DE_S_COMP_PACKAGE2                                                                                    
    DE_S_COMP_PACKAGE_SPEC                                                                                
    DE_S_PACKAGE_BODY1                                                                                    
    DE_S_PACKAGE_BODY                                                                                     
    SE_PACKAGE                                                                                            
    SE_COMP_PACKAGE                                                                                       
    SE_COMP_PACKAGE2                                                                                      
    SE_COMP_PACKAGE_SPEC                                                                                  
    SE_PACKAGE_BODY                                                                                       
    PACKAGE                   PACKAGE_T                 KU$_PROC_T                KU$_PKG_VIEW            
    PACKAGE                   PACKAGE_BODY_T            KU$_PROC_T                KU$_PKGBDY_VIEW         
    PACKAGE                   FULL_PACKAGE_T            KU$_FULL_PKG_T            KU$_FULL_PKG_VIEW       
    PACKAGE_SPEC              PACKAGE_T                 KU$_PROC_T                KU$_PKG_VIEW            
    PACKAGE_BODY              PACKAGE_BODY_T            KU$_EXP_PKG_BODY_T        KU$_EXP_PKG_BODY_VIEW   
    ALTER_PACKAGE_SPEC        ALTER_PACKAGE_SPEC_T      KU$_ALTER_PROC_T          KU$_ALTER_PKGSPC_VIEW   
    ALTER_PACKAGE_BODY        ALTER_PACKAGE_BODY_T      KU$_ALTER_PROC_T          KU$_ALTER_PKGBDY_VIEW   
    18 rows selected.

  • Filling record object types dynamically

    The example below shows the code to create two object types, and in the PL/SQL block the record object type is filled.
    create type parameter_type as object
    (name varchar2(30)
    ,value varchar2(250));
    create type parameterset_type as table of parameter_type;
    declare
    l_parameters parameterset_type;
    begin
    l_parameters := parameterset_type
    (parameter_type('par1', 'value1')
    ,parameter_type('par2', 'value2')
    end;
    Is it possible to fill the record object type in a more dynamic way than by a single assignment, as in the example? I would like to be able to create a loop in which I fill the rows one by one.
    So something like:
    declare
    cursor c_prm is
    select name
    from parameters
    order by seqnr;
    begin
    for r_prm in c_prm
    loop
    -- add parameter c_prm.name to parameterlist
    end loop;
    end;

    just guessing but in that case, build an array or table where you can put every record.
    type t_dummy is table of parameter_type;
    declare
    v_dummy t_dummy := t_dummy(null);
    v_dummy.extend;
    v_dummy(i) := parameterset_type
    (parameter_type(r_prm.name, 'value1');

  • Convert variable type f into variable type p decimals 2

    Hi,
    How can i convert a type f variable into a type p decimals 2 variable?
    I'm trying to make this division:
    var type f.
    var1 type p decimals 2
    var = 50 / 100.
    the result is:
    var = 5.0000000000000000E-01
    if i do
    move var to var1.
    the result is:
    var1 = 0.01 ???
    can anyone tell me what i'm doing wrong?

    DATA: var type f,
          var1 type p decimals 2.
    var = 50 / 100.
    WRITE:/ var.
    move var to var1.
    WRITE:/ var1.
    Result is: 0.50
    I don't see what's your problem...
    Greetings,
    Blag.

Maybe you are looking for

  • Unit of Measure is not defaulting on the SC

    Hi Gurus, I have an issue in SRM 7.01 shopping cart that Unit of measure is blank when the shopping cart is opened... But it defaults the value EA before.. Can someone tell me what is the issue..

  • Creation of Table in UI5

    Hi, I am using SAPUI5 I installed it from following path The toolset can be downloaded from the SAP Service Marketplace (SMP). Go to https://service.sap.com -> SAP Support Portal -> SAP Software Download Center -> Support Packages and Patches -> A -

  • Mic on headset only works when downward pressure is applied to the connection to the mic jack

    can anyone help with this? Seems like bad connection, can it be fixed for a reasonable cost?

  • BI Admin Cockpit Queries - BI 7.0

    Hi All, I have a requirement to build a BW Statistics quesries on BI 7.0. We already activated the BW 7.0 Statistics. Now i am in the process of creating BW queries on BI 7.0 BI Stats multiproviders. My question is whaich business contenct Queries /

  • Opinions About New High Resolution Displays

    Does anyone have an opinion about the MacBook Pro's new high resolution display option. The price doesn't seem to be that big of a deal. My concern is that the higher number of pixels for the same screen area will mean smaller text display. Am I corr