Function to find out datatype of a variable

hi
can anyone tell me a function that can find out what type of datatype a variable belongs to...
thank u
rajiv

You can overload the function in a package.
SQL> create or replace package say_kids as
  2    function what_type_is_it (p number) return varchar2;
  3    function what_type_is_it (p varchar2) return varchar2;
  4    function what_type_is_it (p date) return varchar2;
  5    function what_type_is_it (p sys_refcursor) return varchar2;
  6  end;
  7  /
Package created.
SQL> create or replace package body say_kids as
  2    function what_type_is_it (p number) return varchar2 is
  3    begin
  4      return 'It''s a number.';
  5    end;
  6    function what_type_is_it (p varchar2) return varchar2 is
  7    begin
  8      return 'It''s a string.';
  9    end;
10    function what_type_is_it (p date) return varchar2 is
11    begin
12      return 'It''s a date.';
13    end;
14    function what_type_is_it (p sys_refcursor) return varchar2 is
15    begin
16      return 'It''s a cursor.';
17    end;
18  end;
19  /
Package body created.
SQL> select say_kids.what_type_is_it ( 1 ) from dual;
SAY_KIDS.WHAT_TYPE_IS_IT(1)
It's a number.
SQL> select say_kids.what_type_is_it ( 'test' ) from dual;
SAY_KIDS.WHAT_TYPE_IS_IT('TEST')
It's a string.
SQL> select say_kids.what_type_is_it ( sysdate ) from dual;
SAY_KIDS.WHAT_TYPE_IS_IT(SYSDATE)
It's a date.
SQL> var c refcursor
SQL> select say_kids.what_type_is_it ( :c ) from dual;
SAY_KIDS.WHAT_TYPE_IS_IT(:C)
It's a cursor.
SQL>

Similar Messages

  • Problem finding out datatype for jdbc scenario

    Hi all,
    Here is my scenario. JDBC(oracle)->FILE
    I have a database table orders in oracle with three fields id,name,num. I want to select this table values and map to a different format and send it to a file system.
    Can anyone tell me what should be the format of the sender message interface(or data type)?
    I've created sender message as ordersJDBC with three fileds id name num. i've configured sender adapter too..but i didnt see any message in my xi server!!!
    one more thing should i change the document name in sender jdbc communication channel form resultset to my sender message interface ?
    I think the datatype may be wrong can anyone please help me with this?
    Thanks in advance.......
    Santhosh.

    Hi All,
    It's been a great support from you all, I really appreciate your time.
    I've seen the status of my adapter and got the message like "The Network adapter could not establish the connection".
    Is it the problem with my connection parameter. Did i mention it correct?
    can anyone please cross check my settings......
    driver: oracle.jdbc.driver.OracleDriver
    connection: jdbc:oracle:thin:@ipaddress:port:databasename
    where can i find the information regadring oracle driver in my xi server?
    Thanks in advance.......
    Santhosh.
    Message was edited by: santhosh goli

  • Find the datatype of a variable

    I see exceptions thrown while there is a data mismatch.
    Is there any way in java to find the data type of an declared variable.
    Thanks

    slashercopec wrote:
    getClass() returns the Class object, which you can call getName() on
    e.g.
    variable.getClass().getName();
    Not if it's a primitive type.
    db

  • How to find out if a certain variable is personalized?

    Is there any way for a web template to know if a user has personalized a variable? We are trying to encourage users to personalize reports for their cost center. If a user does not have cost center personalized, I'd like to display a notice telling the user how to personalize the variable. If cost center is already personalized, then this notice is not necessary.
    Thanks,
    Jason

    Hi Heike,
    I have created a query to report off the ODS 0PERS_VAR and altough I can see data through Active data, the query when run shows "no applicable data found". Can you enlighten me on how to make this work.
    Cheers,
    Mike

  • Writing plsql function to find out repeating character in a string

    I need to write one pl sql function to compare 2 consecutive character in a word that they are same or not, if same return false otherwise return true. could any one help me on this
    what i have written pasting here code or make me correct
    CREATE OR REPLACE FUNCTION validate_password (v_string IN VARCHAR2)
    RETURN BOOLEAN
    IS
    v_number NUMBER (3) := 1;
    i_length NUMBER (3);
    BEGIN
    SELECT LENGTH (v_string) INTO i_length FROM DUAL;
    IF (i_length > 0)
    THEN
    FOR v_number IN v_number .. i_length
    LOOP
    substring (v_string, v_number, 1) :=
    substring (v_string, v_number + 1, 1);
    v_number := v_number + 1;
    END LOOP;
    END IF;
    RETURN v_string;
    EXCEPTION
    WHEN OTHERS
    THEN
    DBMS_OUTPUT.put_line ('message');
    END;
    Thanks in advance.

    no need to SELECT FROM DUAL;
    How do I ask a question on the forums?
    SQL and PL/SQL FAQ
    scroll down to #9 to see how to use tags as below
    [code]
    CREATE OR replace FUNCTION Validate_password (v_string IN VARCHAR2)
    RETURN BOOLEAN
    IS
      v_number NUMBER (3) := 1;
      i_length NUMBER (3);
    BEGIN
        i_length  := Length (v_string) ;
        IF ( i_length > 0 ) THEN
          FOR v_number IN v_number .. i_length LOOP
              Substring (v_string, v_number, 1) :=
              Substring (v_string, v_number + 1, 1)
              v_number := v_number + 1;
          END LOOP;
        END IF;
        RETURN v_string;
    EXCEPTION
      WHEN OTHERS THEN
                 dbms_output.Put_line ('message');
    END;
    [/code]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Standard function to find alphabet in string?

    Is there a standard function to find alphabet in string?
    For example, a variable define as char (10),
    I need a function to find out if this variable contains alphabet.
    Any standard function there?

    hiii
    use following code
    data: wa_str(100) type c.
    data: wa_str1 type string.
    data: wa_str2 type string.
    data: wa_str3 type string.
    data: len type i.
    data: ofset type i.
    wa_str = 'ABCD435hjK'.
    len = strlen( wa_str ).
    TRANSLATE wa_str TO UPPER CASE.
    do.
      if ofset = len.
        exit.
      endif.
    if wa_str+ofset(1) co sy-abcde  .
          concatenate wa_str2 wa_str+ofset(1) into wa_str2.
    else.
        concatenate wa_str3 wa_str+ofset(1) into wa_str3.
      endif.
      ofset = ofset + 1.
    enddo.
    write:/ wa_str.
    write:/ 'alphabatic char', 20 wa_str2.
    here TRANSLATE wa_str TO UPPER CASE.
    statement have added .i hope this will solve your problem.
    regards
    twinkal

  • How to find out that a record is empty or null

    hi
    how can i find out that a record is empty or null.
    in other languages when a object or record is not initialized it will be null.
    after initialization how can i find out its values are null. so far i tried this
    declare
    v_r_emp emp%rowtype := null;
    BEGIN
         if (v_r_emp is null) then
         dbms_output.put_line('record is not initialized');
         end if;
    END;
    it seems in plsql we can assign null but cannot compare it with null clause why? if we are able of assign null we must should about to compare it with null too.
    also how record can be made empty. how can we find out that a record variable is empty
    please help me to understand the concept
    thanks

    You need to check every element in the record.

  • How to find out if a NODE has any CHILD NODES in a hierarchical tree?

    I want to find out programmatically if a node in a tree has CHILDREN.
    My requirement is this: I want to only show nodes for which the user has permission to execute the program that node is associated with.
    Problem is, my tree population query will not show the child nodes, BUT the sub-menu nodes are displayed and I need to get rid of these nodes.
    There is a function to find out the PARENT of a tree node (FTree.Get_Tree_Node_Parent), but noting to find out if children exist for a node or not?
    What I thought of was to display the tree and then traverse it from the ROOT onwards and then if a NODE is a submenu node (I can find this out by checking the PROGRAM value. If this is NULL it is a sub-menu node) and IF IT HAS NO CHILD NODES then I can delete the node.

    Please provide the examples with DATA
    as far as i know we cannot get the Child Nodes but NODE's Parents we can get
    parent_node := Ftree.Get_Tree_Node_Parent(htree, :SYSTEM.TRIGGER_NODE);I faced the similar problem but i solved it with query.
    Provide the data and your Tree query then we can help

  • Find out os language at runtime???

    Hi,
    how can I find out the operating system language at runtime? The System and Runtime objects provide several functions to find out OS, computer architecture, version etc, but I couldn't find anything about the os language. Also tried the Locale class... no success.
    Thanks for help!

    ok got it, it is Locale.getDefault().getDisplayLanguage().
    :-)

  • Is it a way to find out which secure zone user belong to?

    So we have three secure zones on website.
    Basic User
    Intermediate User
    Premium User
    Based on where user belong to we would like to show accurate user menu upon him/her logging in the website.
    Currently we have a module to find out if  ANY USER has logged in or not - {module_isloggedin}. Is there similar type of module or functionality to find out which secure zone this user belong to - something like {module_securezonebelongto}, which returns an ID for secure zone using which and with some help of JS we could manipulate user menu options.
    I am sure many of us are looking for similar option and some might have found a solution for this.
    Can you please share your thought(s) and idea(s) for this one? I really appreciate your input.
    Thanks

    The only thing you have is {module_subscriptions}\
    Format:
    {module_subscriptions,show_expiry,show_prices,reserved,render_json}
    Where:
    show_expiry - shows or hides the expiry date of the secure zone (true/false; default:true)
    show_prices - shows or hides the cost of the subscription to that secure zone (true/false; default:true)
    render_json - Will render the secure zone information in Json format which can be manually parsed (true/false)

  • How to find out list of procedures and functions inside a package

    How I can find out the list of Procedures and Functions inside a Package.

    Look at ALL_PROCEDURES and ALL_ARGUMENTS.

  • Function Module to find out the release value in contract

    Dear All,
    I have to upload the contract with new accoutn assignment without changing the existing contract. For that i have to download all the existing contract data with value.
    In that case i have some issues regarding the value.
    For example : In the system old contract is created with value 1000 and the released value as 500.
    In that case i have to uload the new contract with all the details of existing contract with value of 500 (1000-500=500).
    How can i get the value (500) and from which table.Is there any functional module to find out the release value in contract.
    Thanks and regads,
    PM
    Edited by: PM on Jan 21, 2010 8:40 AM
    Edited by: PM on Jan 22, 2010 9:48 AM

    Hi
    You need to link the table VBFA and VBAK.
    For a contract you can check all the subsequent document (which you can filter whether you want to see Order / delivery / Billing) in VBFA and then from there pick the subsequent document no. and then from VBAK you can pick the Net value of these subsequent documents, and so you will have both the values (value of Contract and value in subsequent document) and you can determine the balance value.
    Regards
    Amitesh Anand

  • How do I find out what year my MacBook Pro is?  I want to know if I can use the mirroring function with my Apple TV if I download Mountain Lion.

    I'm trying to find out if I can use the mirror function to look at large construction drawings using my Apple TV.  It says that my MacBook Pro has to be early 2011 or newer and I can't remember what it is.

    Mactracker - Get Info on any Mac

  • How can I find out the web interface a module function is executed from?

    Hello all,
    I was wondering if anybody knows how would be possible de determine the web interface a function is being launched from, within the function.
    I've got this function that is used for a exit variable that updates the variable value depending on another variable in a web interface. The thing is that this very same function and variable will be used in many web interfaces and the "source" variable will be different for each mask.
    So, for example, mask 1 will have variable 1 as a selector variable and variable X will be updated by it. Then I also have variable 2 in mask 2 as a selector variable and variable X will be updated by it as well.
    I want to develop a code, within the function module, that depending on the web interface that is calling it, it will use a source the correct variable and for this I need to know which web interface is calling the function.
    I hope to have been able to explain myself clearly. It's a purely technical question.
    Thanks in advance.
    Best regards.

    Hi Francesco,
    Are you talking about that ??? )) It will explain you about to get the name of the web page when you are executing an abap function for determining the values of variables...
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/biw/g-i/how%20to%20make%20a%20variable%20even%20more%20flexible%20in%20bw-bps.pdf">How to make a variable even more flexible in BW-BPS?</a>
    This is weird: I wrote that document a few weeks ago, it is theorically published on SDN but this is not possible to find it by using the research tool... Maybe because it applies only to BPS in 3.5. I did not have enough time to migrate that solution to BI-IP 7.0.
    Regards
    Laurent

  • How to find out which was the last Function Fired in a given schema ..?

    Hi All ,
    Suppose there is a function called track_account (Accnt_id, bank_name ...)
    I have a requirement wherein I need to find out when was the last date when this function was called , by which user and what was the parameter list that was passed .For example i this case - what accountid and bank_name combinations were passed .
    I know the information is stored in one of the V$ tables but am not able to locate the exact table and column that would give me this information .
    Please suggest .
    Edited by: user3481493 on Mar 8, 2010 10:58 PM

    amol_dev wrote:
    Thank you for your reply Brynjar.
    However, I was trying to figure out a way to do this without having to change the calling command line, because due to legacy reasons, it is not possible to change the command line calling the parent applications of this common code.You cannot change the command line, but you can change the applications?
    In main() do this:
    System.setProperty("whoami",(new Throwable().getStackTrace()[0].getClassName()));Elsewhere:
    String whoami = System.getProperty("whoami");

Maybe you are looking for

  • Java connection to oracle 8.0.5 on linux

    I'm trying to run the TestInstallJDBC program off of your site on a RedHat Linux 5.1 box with Oracle 8.0.5 for linux installed. However it cannot seem to find the following classes when trying to import them: import oracle.sqlj.runtime.Oracle; import

  • There are no songs in my itunes library found when selecting autofill, and dragging songs into device does not do anything now what?

    when i hit auto fill under music it just says Itunes cannot add any song to "___'s Iphone" because no songs in your itunes library could be found. there clearly is an anbundance of music that I have been syncing all the time, I have not the slightest

  • Variable for navigational attribute affected fiscper input variable

    Dear Friends Initially, the query is having an input variable for fiscper. The query was able to run properly. When i add a input variable for a navigational attribute to the same query which is based on multiprovider, the fiscper input variable is n

  • Layer Mask Thumbnail Option

    I'm using PSE 11 and layers masks.  If you click on the layer mask thumbnail you have the option of "add mask to selection" and "intersect mask to selection".  They both select the same area of the photo. So I use the help menu and go online and type

  • Preview Prints at Bottom of Page

    Hello: I'm having an issue with the Preview app printing image files, such as png screen grabs, at the bottom of the page. I can use the Center Image check box to bring it up to the middle, but not the top of the page where I'd like it to be. Suggest