How to make a function return number(10,0) data type (ORACLE 10g)?

With 10g, how to make a function return number(10,0) data type?
here is the function, it returns a number type :
create or replace FUNCTION Get_portfolio_Id3 (p_HistObjTable In Varchar2,p_LHISTOBJID IN NUMBER) RETURN view_cpu_STD_Asset.LPORTFOLIOITEMID%Type IS
v_Id view_cpu_STD_Asset.LPORTFOLIOITEMID%Type;
BEGIN
If p_HistObjTable ='amPortfolio'
then v_Id:=p_LHISTOBJID ;
elsIf p_HistObjTable = 'amComputer' then
select litemid into v_Id from smcdba.amComputer c where c.LCOMPUTERID=p_LHISTOBJID ;
else v_Id:=-99;
End If;
RETURN v_Id;
END Get_portfolio_Id3;
Thanks.
Message was edited by:
user631701

create or replace FUNCTION Get_portfolio_Id3 (p_HistObjTable In Varchar2,p_LHISTOBJID IN NUMBER) RETURN view_cpu_STD_Asset.LPORTFOLIOITEMID%Type IS
v_Id view_cpu_STD_Asset.LPORTFOLIOITEMID%Type;
BEGIN
If p_HistObjTable ='amPortfolio'
then v_Id:=p_LHISTOBJID ;
elsIf p_HistObjTable = 'amComputer' then
select litemid into v_Id from smcdba.amComputer c where c.LCOMPUTERID=p_LHISTOBJID ;
else v_Id:=-99;
End If;
RETURN round(v_Id);
END Get_portfolio_Id3;

Similar Messages

  • Number of available records in Oracle 10g express database

    Hi,
    I am facing problems in getting the number of available records in Oracle 10g express database with the following query.
    string filename = dbObject.FILENAME;
    string vendorID = dbObject.VENDOR_ID;
    OracleCommand myCommand = _connection.CreateCommand();
    myCommand.CommandText = "SELECT COUNT(*) FROM ASSET_PROCESSING_OUTPUT WHERE *FILENAME = :filename AND VENDOR_ID = :vendorID*";
    myCommand.CommandType = CommandType.Text;
    myCommand.Parameters.AddWithValue("filename", filename);
    myCommand.Parameters.AddWithValue("vendorID", vendorID);
    OracleDataReader reader = myCommand.ExecuteReader();
    Using this command how can I get if the record exists in the database with the given value.
    Thanks in advance.
    punit

    It appears you're only executing the statement. You need to fetch the result to see the value returned by the SELECT statement.

  • What is the maximum number of characters in an Oracle 10G Instance Name

    All,
    Can I know what is the maximum number of characters in an oracle 10g instance name under AIX? Is it 7 characters or 8 characters?
    regards
    Santhosh

    One should really make the difference between db_name and instance_name: if instance_name default value is db_name it can be different
    (even on a non RAC database).
    For example with Oracle 10.2.0.4 you can create a database named DB78 with instance_name=DB12345678:
    $ uname -a
    Linux lx01.localdomain 2.6.18-92.el5 #1 SMP Fri May 23 22:17:30 EDT 2008 i686 i686 i386 GNU/Linux
    $ ps -fu oracle | grep smon
    oracle    6353     1  0 20:30 ?        00:00:01 ora_smon_DB12345678
    oracle    6412  5596  0 20:37 pts/1    00:00:00 grep smon
    $ export ORACLE_SID=DB12345678
    $ sqlplus / as sysdba
    SQL*Plus: Release 10.2.0.4.0 - Production on Wed Sep 8 20:34:26 2010
    Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL> show parameter name
    NAME                                 TYPE        VALUE
    db_file_name_convert                 string
    db_name                              string      DB78
    db_unique_name                       string      DB78
    global_names                         boolean     FALSE
    instance_name                        string      DB12345678
    lock_name_space                      string
    log_file_name_convert                string
    service_names                        string      DB78I would not recommend this practice: but it's interesting to know to avoid confusing between db_name and instance_name.

  • How to check/find the size of current ROLLBACK segment in oracle 10g

    How to check/find the size of current ROLLBACK segment in oracle 10g ? Kindly help

    A rollback segment name like "_SYSSMU231$" is used when you have Automatic Undo Management enabled.
    The only relevant parameters are :
    1. UNDO_MANAGEMENT=AUTO
    2. UNDO_RETENTION=n minutes ==> this is what everyone should be interested in
    3. The sizes of the Undo Tablespace datafiles and whether AUTOEXTEND is ON or OFF
    No one should be interested in the size of a single undo segment when Automatic Undo Management is enabled.
    Possible causes of ORA-01555 errors in Automatic Undo Management
    a. UNDO_RETENTION is too low
    b. Undo tablespace is too small
    Hemant K Chitale

  • What is the function of _xdb and _xpt services in oracle 10g database.

    what is the function of xdb and xpt services in oracle 10g database.?

    Hi,
    If you are troubleshooting check the below link too:
    Issues installing.  Listener not working
    Best regards,
    Rafi.
    http://rafioracledba.blogspot.com/

  • How to make a function out of a query

    Hi,
    I have the following query:
    select
    to_date(sysdate, 'DD.MM.YYYY') as "FULL_DATE",
    to_number(to_char(sysdate, 'D')) as "DAY_OF_WEEK",
    to_number(to_char(sysdate, 'DD')) as "DAY_NUMBER_IN CALENDAR_MONTH",
    to_number(to_char(sysdate, 'DDD')) as "DAY_NUMBER_IN CALENDAR_YEAR"
    from
    dual
    how to I make a funtion where I can input a start and an ending date and it calculates allt the rows fow the days in between?
    Thanks,
    Walter

    drop type mytabletype;
    create or replace type mytype as object (
    full_date date,
    dow number,
    daynum_m number,
    daynum_y number
    create or replace type mytabletype as table of mytype;
    create or replace function myfunc (p_date in date) return mytabletype pipelined as
      cursor cur_mycur is
      select
        to_date(p_date, 'DD.MM.YYYY') as "FULL_DATE",
        to_number(to_char(p_date, 'D')) as "DAY_OF_WEEK",
        to_number(to_char(p_date, 'DD')) as "DAY_NUMBER_IN_CALENDAR_MONTH",
        to_number(to_char(p_date, 'DDD')) as "DAY_NUMBER_IN_CALENDAR_YEAR"
        from dual;
      x mytype := mytype(null,null,null,null);
    begin
      for i in cur_mycur
      loop
        x := mytype(i.full_date,i.day_of_week,i.day_number_in_calendar_month,i.day_number_in_calendar_year);
        pipe row(x);
      end loop;
    end;
    sho err
    select * from table(myfunc(sysdate));
    select * from table(myfunc(to_date('15/09/2006','dd/mm/yyyy')));is this what you're after.
    If so I suggest you take it away, and get an understanding for it. It's a very useful technique to know.
    I know it doesn't do all the days between 2 dates, but that should be something you can do with a little thought.
    Regards
    Message was edited by:
    blushadow

  • How to make a function take a specific group of constants

    I know i asked this before, maybe a year ago, but I totally forgot how to do it, and I haven't been programming much lately. But I was wondering if somebody can tell me how to make a certain function take specific constants. For example there are java functions, of which I can not remember that will only take certain values. So the function might look like:
    public getInfo(String INFONAME){}Where INFONAME has to be like one of two names or something, and they are constants that are defined somewhere else. If anybody knows what I mean by this, and knows how to create functions like that please let me know. Thank you.

    here's an overkill,
    import java.util.*;
    abstract class DoWhatever {
        public static Hashtable ht = null;
        public static Object DoWhat( String s, Object obj ) {
         if( null == ht ) {
             ht = new Hashtable();
             ht.put( ThisDoWhatever.NAME, new ThisDoWhatever() );
             ht.put( ThatDoWhatever.NAME, new ThatDoWhatever() );        
         return ( (DoWhatever) ht.get( s ) ).doWhatever( obj );
        public abstract Object doWhatever( Object obj );
    class ThisDoWhatever extends DoWhatever {
        public final static String NAME = "this";
        public Object doWhatever( Object obj ) {
         System.out.println( NAME );
         return null;
    class ThatDoWhatever extends DoWhatever {
        public final static String NAME = "that";
        public Object doWhatever( Object obj ) {
         System.out.println( NAME );
         return null;
    public class DoThisOrThat {
        public static void main( String[] args ) {
         DoWhatever.DoWhat( args[ 0 ], null );
    }

  • How can i pass function return values in to varray

    Hi
    create procedure name(parameters list)
    here ---i am calling a function
    varname := function name
    returns 4 values
    My doudt is how can i pass these return values in to varray..
    Type varray vname[5] date type
    Begin
    statements
    end prodedure name;
    pls clarify me its urgent

    This may give u a start
    sql>
    create or replace package test_array_pack as
    type ar1 is varray(10) of number;
    end;
    Package created.
    sql>
    create or replace function test_array return test_array_pack.ar1 is
      v_ar1 test_array_pack.ar1;
    begin
    v_ar1 := test_array_pack.ar1(1,2,3,4);
    return v_ar1;
    end;
    Function created.
    sql>
    declare
    v_ar2 test_array_pack.ar1;
    begin
    v_ar2 := test_array;
    end;
    PL/SQL procedure successfully completed
    Message was edited by:
            jeneesh                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • PL/SQL: How to make a function accessible to all users?

    How can I make a function accessible to all users?
    I have written a stored function called GET_NET_BALANCE.
    I can run it but my users cannot.
    I have tried the following, but my users still cannot
    run the function:
    GRANT EXECUTE ON GET_NET_BALANCE TO PUBLIC;
    Thanks, Eileen

    Hi,
    You can try creating a public synonym on the function so that it is accessible to all.
    To get greater response.. please post your question at
    PL/SQL
    Regards,
    Anupama

  • How to make a function in separate thread

    i need to make a function that is running in a separate thread
    Thank's in advance

    Thank's
    but in my program i have a main class which is a server it runs forever.
    from the main class when i call a function it runs in a separate thread and returns the result to the callee and the main function continue it's work
    class server
    //this function when called must be in separate thread
    public int function(int x)
    //there could be wait here or sleep
    return x*2;
    public static void main(String[] args)
    // Run RMI server
    i hope u understand me!!!
    Thank's

  • Mailing list form, how to make it functional?

    I'm trying to add the typical "Join our Mailing List" form into a website where users can submit their email addresses.  I've built the form and now I need to make it functional.  I don't know a lick of php or databasing, and after investigating it on the web and the forum there seems to be a bunch of different answers and I'm not sure which direction to go in.  Is there an easy way to do this with a premade script somewhere?  Would I have to get it from the company that's hosting the site?  How do I implement it?
    Thanks in advance!!!!

    Awesome, thanks so much for the help CanonBoy.  So I can use this for both my mailing list form and my contact message form?  I opened Dreamweaver and on the contact page I set the form to this:
    <div id="ContactForm">
      <form id="form1" name="form1" method="post" action="contact.php">
        <table width="300">
          <tr>
            <td colspan="2"><span class="MainText">All information will be kept private</span></td>
          </tr>
          <tr>
            <td width="61"><span class="MainText">Name:</span></td>
            <td width="227"><span class="MainText">
              <input name="Name" type="text" id="Name" size="25" />
            </span></td>
          </tr>
          <tr>
            <td><span class="MainText">Email:</span></td>
            <td><span class="MainText">
              <input name="Email" type="text" id="Email" size="25" />
            </span></td>
          </tr>
          <tr>
            <td><span class="MainText">Phone:</span></td>
            <td><span class="MainText">
              <input name="Phone" type="text" id="Phone" size="25" />
            </span></td>
          </tr>
          <tr>
            <td> </td>
            <td> </td>
          </tr>
          <tr>
            <td><span class="MainText">Message:</span></td>
            <td><span class="MainText">
              <textarea name="Message" id="Message" cols="23" rows="5"></textarea>
            </span></td>
          </tr>
          <tr>
            <td> </td>
            <td> </td>
          </tr>
          <tr>
            <td> </td>
            <td><input name="Clear" type="reset" class="MainText" id="Clear" value="Clear" />
            <input name="Submit" type="submit" class="MainText" id="Submit" value="Submit" /></td>
          </tr>
        </table>
      </form>
    </div>
    Do I have to change the form ID and the name in line 2?  And also I'm not sure what you meant about the hidden field, what exactly do I copy and paste and where do I put it?  And is there a generic form on the tectite site I can add the client's email address to, change it to contact.php and upload it?  Thanks big time!!!

  • How to execute a function returning type in oracle

    hi
    i want to execute a function which is returning table from oracle prompt.
    i have created type in order to return table from function.
    /*creating type
    CREATE OR REPLACE TYPE U_VOC.t_in_list_tab AS OBJECT (i_group NUMBER ,
                                  i_company number,
                                  i_estab number
    NOT FINAL ;
    CREATE OR REPLACE TYPE U_VOC.t_in_list_tab_type
    AS TABLE OF U_VOC.t_in_list_tab;
    /*function */
    CREATE OR REPLACE FUNCTION FU_VOC_S_VEHICLES(pi_group number,
                                                      pi_company number,
                                                 pi_estab number
         RETURN t_in_list_tab
    AS
    v_nb_idvehicle           U_REF.V_REF_VEHICLES.NB_IDVEHICLE%type ;
    v_vc_reference           U_REF.V_REF_VEHICLES.VC_REFERENCE%type ;
    v_vc_licenceplate      U_REF.V_REF_VEHICLES.VC_LICENCEPLATE%type ;
    l_tab t_in_list_tab := t_in_list_tab( pi_group ,pi_company, pi_estab );
    BEGIN
              SELECT      V_REF_VEHICLES.NB_IDVEHICLE,
                   V_REF_VEHICLES.VC_REFERENCE,
                   V_REF_VEHICLES.VC_LICENCEPLATE
              INTO      V_NB_IDVEHICLE,
                   V_VC_REFERENCE,
                   V_VC_LICENCEPLATE
              FROM      U_REF.V_REF_VEHICLES
              WHERE      V_REF_VEHICLES.NB_IDGROUP = pi_group
              AND      V_REF_VEHICLES.NB_IDCOMPANY = pi_company
              AND      V_REF_VEHICLES.NB_ESTABL = pi_estab;
    RETURN l_tab;
    END;
    please help
    Thank in advance
    Sandy

    Sandy,
    I have a series of examples on this issue in my demo application. See this one:
    http://htmldb.oracle.com/pls/otn/f?p=31517:146
    You will basicaly need to write it like this:
    CREATE OR REPLACE TYPE u_voc.t_in_list_tab AS OBJECT (
       i_group     NUMBER,
       i_company   NUMBER,
       i_estab     NUMBER
    CREATE OR REPLACE TYPE u_voc.t_in_list_tab_type AS TABLE OF u_voc.t_in_list_tab;
    CREATE OR REPLACE FUNCTION fu_voc_s_vehicles (
       pi_group     NUMBER,
       pi_company   NUMBER,
       pi_estab     NUMBER
       RETURN t_in_list_tab PIPELINED
    AS
       l_tab   t_in_list_tab := t_in_list_tab (NULL, NULL, NULL);
    BEGIN
       FOR c IN (SELECT v_ref_vehicles.nb_idvehicle, v_ref_vehicles.vc_reference,
                        v_ref_vehicles.vc_licenceplate
                   FROM u_ref.v_ref_vehicles
                  WHERE v_ref_vehicles.nb_idgroup = pi_group
                    AND v_ref_vehicles.nb_idcompany = pi_company
                    AND v_ref_vehicles.nb_establ = pi_estab)
       LOOP
          l_tab.i_group := c.nb_idvehicle;
          l_tab.i_company_number := c.vc_reference;
          l_tab.estab_number := vc_licenceplate;
       END LOOP;
       RETURN l_tab;
    END;
    SELECT *
      FROM TABLE (fu_voc_s_vehicles (value1, value2, value3))But looking at your code, your function will return only one record.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/apex/f?p=107:7
    http://htmldb.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • How to make a Carriage Return in a Word-Table by OLE Automation

    I generated a Table in a Word-Document by using the OLE2 Interface.
    After that I wrote a Text in the first cell of the table.
    Now I want to make a Carriage Return to write another Textline in the same Cell.
    But first i must move the cursor to the end of the Text.
    I haven't already figured that out.
    Can someone Help me?
    I tried this but then the Cursor moves to the Begin of the second Cell in the same row.
    *Writing the Text in the Cell
      GET PROPERTY OF o_cell 'Range' = o_range.
      SET PROPERTY OF o_range 'Text' = wa_anschr-ename.
    *Move Cursor
      GET PROPERTY OF o_cell  'Range' = o_range.
      GET PROPERTY OF o_range 'End' = ld_pos.
      SET PROPERTY OF o_range 'Start' = ld_pos.
      CALL METHOD OF o_range ' Select'.

    I don't know about your suggestion.
    I solved the Problem with that Method:
    CALL METHOD OF o_selection 'EndKey'
        EXPORTING
          #1 = '5'.
      CALL METHOD OF o_selection 'TypeParagraph'.
    The Parameter "5" ist the VB Constant wdline...
    Now it works and I'm happy

  • How to use Call library function node for a function in dll with VOID data type

    Hi All,
    I would like to ask for your kind help,
    I am facing an issue with the call library node.
    I have a C++ function(stdcall), which has void as data type
    error code XXXX(hwnd, lID, getValue, *void data1, *void data2)
    the data1 and data2 types are always changing depending upoin the value of "getValue".
    Primarily i can use call library node multiple times and adapt each node according to the data types of data1 and data2, and extract the values and use in the code. Here is no issue. Real question is:
    My question:
    How can i just use one time call library node and make a case depending upon the "getvalue", which will control the data type of data1 and data2. Here i really looking for solutions.
    My trials:
    i used varaints as input to the call libray node for data1 and data2, and selected Parameters in call libraby node as " Adapt to type". here labview just crashed.
    i really appreciate your feedbackand suggestions.
    Thanks
    Kutbuddin
    Solved!
    Go to Solution.
    Attachments:
    Clipboard02.jpg ‏103 KB

    A variant is a very specific LabVIEW datatype (really a C++ type object internally) and trying to pass that to a function, which excepts a flat memory pointer there, for sure will crash very quickly.
    As to endianess, yes Unflatten will be able to adjust for endianess, which in this case however is most likely exectly NOT what you want. So make sure that the you select native type for the endianess input on Unflatten from String. LabVIEW internally works with whatever is the native endianess, as will most likely your C++ DLL. The platform independent big endian format does only come into play when you receive data streams over some streaming interface like a network connection. Here it is desirable to use an endian format that is independent from the actual platform that generates and consumes the data stream. LabVIEWs default endianes is big endian here.
    But as long as you pass data directly to native components like DLLs there is no difference in endianess between what LabVIEW uses and what those components use.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Pipeline Table Function returning a fraction of data

    My current project involves migrating an Oracle database to a new structure based on the new client application requirements. I would like to use pipelined table functions as it seems as though that would provide the best performance.
    The first table has about 65 fields, about 75% of which require some type of recoding for the new app. I have written a function for each transformation and have all of these functions stored in a package. If I do:
    create new_table as select (
    pkg_name.function1(old_field1),
    pkg_name.function2(old_field2),
    pkg_name.function3(old_field3),
    it runs with out any errors but takes about 3 1/2 hours. There are a little more than 10 million rows in the table.
    I wrote a function that is passed the old table as a cursor, runs all the functions for the transformations and then pipes the new row back to the insert statement that called the function. It is incredibly fast but only returns .025% of the data (about 50 rows out of my sample table of 200,000). It does not throw any errors.
    So I am trying to determine what is going on. Perhaps one of my functions has a bug. If there was would cause the row to be kicked out? There are 40 or so functions so tracking this down has been a bit of a bear.
    Any advice as to how I might resolve this would be much appreciated.
    Thanks
    Dan

    . I would like to use pipelined table functions as it seems as though that would provide the best performanceUh huh...
    it runs with out any errors but takes about 3 1/2 hours. There are a little more than 10 million rows in the table.Not the first time a lovely theory has been killed by an ugly fact. Did you do any bench marks to see whether the pipelined functions did offer performance benefits over doing it some other way?
    From the context of your comments I think you are trying to a populate a new table from a single old table. Is this the case? If so I would have thought a straightforward CTAS with normal functions would be more appropriate: pipelined functions are really meant for situations in which one input produced more than one output. Anyway, ifr we are to help you I think you need to give us more details about how this process works and post a sample transformation function.
    There are 40 or so functions so tracking this down has been a bit of a bear.The teaching is: we should code one function and get that working before moving on to the next one. Which might not seem like a helpful thing to say, but the best lesson is often "I'll do it differently next time".
    Cheers, APC

Maybe you are looking for

  • Changing Views in Leopard Mail...2 Pane view as opposed to default?

    Does anyone know how to get Apple Mail in Leopard to have the 2 pane view as opposed to the default 3? In Tiger I had it, but I can't remember. Before Leopard all my information was in vertical columns I much prefer that view...thanks!

  • How do I update the list of applications in the help panel?

    When I hit F1, the help module comes up. It has a very outdated list of Adobe applications. For example, I've owned Lightroom 3, 4, and now 5. Only 3 shows up in the list of applications for which I can search. How do I add/delete applications for wh

  • Query of queries case sensitive

    Hi, I've a question regarding this issue.  I am pulling data from an xml file and dump that data into query of queries then output them.  The problem is when I try to order the query ASC, the upper will be top and the lower will be on the bottom.  Is

  • Not appearing task list in object links tab of document type

    Hi guys, I had an small issue in document type, which is in doucment type object links tab I am unable to find task list data. Nothing is coming up here when i click this task list.  Could any one can help me to get that data. Munny.

  • Of Podcasts and Playlists...

    I'm sorry if this has been posted, but I can't find it. My podcasts playback from latest to oldest, and I can't find a way to reverse it's play order. Only solution I found online is to create a playlist, or smart playlist... which brings on a new pr