Verifing the data type

Hi,
I'd like to know how can I verify if the variable contains only the data type that I'm expecting for. In SQLSERVER we have the IS_NUMERIC, IS_CHAR... functions. Is there something similar in ORACLE? How can I use it?
Thanks.

It is easy enough to test whether a value is numeric. You can create a function like:
CREATE OR REPLACE FUNCTION IS_NUMBER (p_test_val IN VARCHAR2)
RETURN BOOLEAN IS
l_t_val NUMBER;
BEGIN
   l_t_val := TO_NUMBER(p_test_val);
   RETURN TRUE;
EXCEPTION WHEN VALUE_ERROR THEN
   RETURN FALSE;
END;This attempts to convert the value passed in (note that the parameter is a character type) to a number. If it suceeds, then it retrns TRUE. If the conversion causes an error, then the exception handler catches it and returns FALSE.
The BOOLEAN data type is only valid in PL/SQL (and probably other host languages like C or Java), you cannot use this function in a SQL statement. To use this in a SQL statement, then you would need to change the return type to number, and return something like 1 for TRUE and 0 for FALSE.
To use the function in a PL/SQL procedure, you could do something like:
DECLARE
l_val_to_test VARCHAR2(10) := '123';
BEGIN
   IF is_number (l_val_to_test) THEN
      DBMS_OUTPUT.Put_Line ('Value is a number');
   ELSE
      DBMS_OUTPUT.Put_Line ('Value is not a number');
   END IF;
END;Which would return TRUE.
TTFN
John

Similar Messages

  • Any idea what this errorr means? the data type of the reference does not match the data type of the variable

    I am using Veristand 2014, Scan Engine and EtherCat Custom Device.  I have not had this error before, but I was trying to deploy my System Definition File (run) to the Target (cRio 9024 with 6 modules) and it failed. It wouldn't even try to communicate with the target. I get the 'connection refused' error.  
    I created a new Veristand project
    I added the Scan Engine and EtherCat custom device.
    I changed the IP address and auto-detected my modules
    i noticed tat Veristand didn't find one of my modules that was there earlier. (this week)
     So, i went to NiMax to make sure software was installed and even reinstalled Scan Engine and Veristand just to make sure.
    Now, it finds the module, but when i go to deploy it getsto the last step of deploying the code to the target, and then it fails.
    Any thoughts?
    Start Date: 4/10/2015 11:48 AM
    • Loading System Definition file: C:\Users\Public\Documents\National Instruments\NI VeriStand 2014\Projects\testChassis\testChassis.nivssdf
    • Initializing TCP subsystem...
    • Starting TCP Loops...
    • Connection established with target Controller.
    • Preparing to synchronize with targets...
    • Querying the active System Definition file from the targets...
    • Stopping TCP loops.
    Waiting for TCP loops to shut down...
    • TCP loops shut down successfully.
    • Unloading System Definition file...
    • Connection with target Controller has been lost.
    • Start Date: 4/10/2015 11:48 AM
    • Loading System Definition file: C:\Users\Public\Documents\National Instruments\NI VeriStand 2014\Projects\testChassis\testChassis.nivssdf
    • Preparing to deploy the System Definition to the targets...
    • Compiling the System Definition file...
    • Initializing TCP subsystem...
    • Starting TCP Loops...
    • Connection established with target Controller.
    • Sending reset command to all targets...
    • Preparing to deploy files to the targets...
    • Starting download for target Controller...
    • Opening FTP session to IP 10.12.0.48...
    • Processing Action on Deploy VIs...
    • Setting target scan rate to 10000 (uSec)... Done.
    • Gathering target dependency files...
    • Downloading testChassis.nivssdf [92 kB] (file 1 of 4)
    • Downloading testChassis_Controller.nivsdat [204 kB] (file 2 of 4)
    • Downloading CalibrationData.nivscal [0 kB] (file 3 of 4)
    • Downloading testChassis_Controller.nivsparam [0 kB] (file 4 of 4)
    • Closing FTP session...
    • Files successfully deployed to the targets.
    • Starting deployment group 1...
    The VeriStand Gateway encountered an error while deploying the System Definition file.
    Details:
    Error -66212 occurred at Project Window.lvlibroject Window.vi >> Project Window.lvlib:Command Loop.vi >> NI_VS Workspace ExecutionAPI.lvlib:NI VeriStand - Connect to System.vi
    Possible reason(s):
    LabVIEW: The data type of the reference does not match the data type of the variable.
    =========================
    NI VeriStand: NI VeriStand Engine.lvlib:VeriStand Engine Wrapper (RT).vi >> NI VeriStand Engine.lvlib:VeriStand Engine.vi >> NI VeriStand Engine.lvlib:VeriStand Engine State Machine.vi >> NI VeriStand Engine.lvlib:Initialize Inline Custom Devices.vi >> Custom Devices Storage.lvlib:Initialize Device (HW Interface).vi
    • Sending reset command to all targets...
    • Stopping TCP loops.
    Waiting for TCP loops to shut down...
    • TCP loops shut down successfully.
    • Unloading System Definition file...
    • Connection with target Controller has been lost.

    Can you deploy if you only have the two 9401 modules in the chassis (no other modules) and in the sysdef?  I meant to ask if you could attach your system definition file to the forum post so we can see it as well (sorry for the confusion).  
    Are you using any of the specialty configurations for the 9401 modules? (ex: counter, PWM, quadrature, etc)
    You will probably want to post this on the support page for the Scan Engine/EtherCAT Custom Device: https://decibel.ni.com/content/thread/8671  
    Custom devices aren't officially supported by NI, so technical questions and issues are handled on the above page.
    Kevin W.
    Applications Engineer
    National Instruments

  • Not Able to Load the data type "Non Currency"in Planning accounts dimension

    Dear All,
    We are building Meta data in planning using HAL 9.2 ...while construction of accounts we were able to assign "Currency" Data Type ,but were unable to add the "Non Currency" data types to account members.
    We have mentioned "Non Currency" in the the Data Type Field.
    Thanks in Advance.

    Hi Guys my issue is resolved..... just wanted to let you know that you will need to write "Non-Currency" in the field name in the csv for marking accounts as Non currency data type.

  • Can we change the data type of a field based on the value of the field

    HI Gurus,
    My Requirement is as below -- Could you please guide me
    in the Printable Adobe form -- for ex - as usual for dates fields in the Object Pallette the object type is a date/time field  and for quantity/currency fields corresponding fields are taken
    now in case the either the date, quantity or currency is initial in place of displaying 0.00 or empty date we need to display N/A (Not Applicable)
    for this I would like to change the data type of the field
    to put it simply --
    we need to change the data type of date field from DATE&TIME to Char type to hold N/A or  Quantity field to Char field to hold N/A
    how can we realize this in SAP adobe forms
    Thanks in Advace
    Ramchander Rao.K

    Hello Ramchander,
         You cannot change the data type of the field at run time in Adobe forms because the type of field you choose at the time of design level is associated with the data type itself.
    If you want to achieve your requirement, then your main idea should be to set the data type as CHARACTER itself while designing the field in the adobe form itself. CHAR field will comfortably hold the value of Calculation/amount field, Currency field, Amount, Date, Time HHMMSS, Unit Accuracy, Currency key, Floating point number, Numeric text, Client, Language and many other data types.
    After designing the field as TEXT field in Adobe form you have two options.
    Option 1:
    Select the Date field initially as type TEXT field or CHAR field in Adobe forms.
    Suppose the name of the field is TEXTFIELD1, then write the Javascript code on this field in Initialize event as below.
    if ( this.rawvalue == null )
         this.rawvalue = "N/A";
    If the field is not blank, then it will show the date. Else it will show "N/A".
    Option 2:
    Select the Date field initially as type TEXT field or CHAR field in Adobe forms. Do the formatting part in ABAP itself. It will increase the performance. Avoid Javascript as much as possible.
    Suppose you have a DATE variable l_dats of type DATS. Then take another variable l_date of type CHAR. Then write the below ABAP code.
    MOVE l_dats TO l_date.
    IF l_date IS INITIAL.
         l_date = 'N/A'.
    ENDIF.
    Bind the l_date to the TEXT field in the form.
    Even in this case, if the field is not blank, then it will show the date. Else it will show "N/A".
    But I will suggest you to use Option 2 of keeping the AMOUNT, QUANTITY, DATE, TIME fields etc as CHAR or TEXT fields in Adobe form and do the required formatting in ABAP itself.

  • Can I modify the data type of a dynamic parameter?

    I am using CR2008 against an Oracle 11 db and have a report with dynamic parameters.
    One of the report sources is a custom view that selects all of the possible 'pay ending dates' where one of the fields from this view is used as the source for the dynamic parameter.
    The view performs a TRUNC on the date field in an effort to eliminate the TIME component.
    The problem is that the parameter definintion defaults to DATE/TIME (vs. just DATE). I'm wondering if there is any way to modify the data type of the parameter to be DATE only.
    I've searched several forumns but have not found anything.
    One solution I can think of is to have the custom view format the date field as a VARCHAR (sans the time component) which I assume would force the dynamic parameter data type to string, and then have the report perform a todate function on the value when applying the criteria.
    Anyone else have an idea? Just seems like CR should allow the developer to specify the data type- especially b/w Date and Date/Time, rather than make an assumption.
    Thank you in advance-
    emaher

    emaher,
    Here's what you can do:
    Leave the existing date column as it is in the view...
    Just add another column to the view that casts the the date as a VarChar data type and formats the date as you would like it to be.
    So now you'll have 2 date columns in the view... 1 that's still a date and another that a character string.
    Now for your parameter, use the date version as the parameter value and the text version as the parameter description.
    Be sure to set the "Prompt with description only" is set to true.
    This way the user sees the LoV in the desired format but there's not need to wrangle it back into a date for data selection.
    HTH,
    Jason

  • How can I read the data type of a field in an MS Access database

    I need to be able to determine if a field in an Access database is of a certain data type, and if it isn't, to change it to what it should be.
    I can't seem to find any way of reading the data type of any field in any table - can anyone give me a metod of getting this info?
    Thanks
    ..Bob

    Does <cfdbinfo> work for Access DBs?
    You might be better off asking this on a MS Access forum.  It's more of an Access issue than a CF one.
    Adam

  • How to retrieve the data type of a column of a table?

    Hi,
    I want to retrieve the data type of a column of a table. At the moment I am querying "OCI_ATTR_DATA_TYPE" attribute but it is returning SQLT_CHR for both varchar2 and nvarchar2 data type columns. I need to distinguish between these two data types columns separately. Is there any API through which I could get the exact data type of a column i.e. "nvarchar2"?
    Thanks in advance.
    Hashim

    Hi,
    This is the Oracle C++ Call Interface (OCCI) forum - I'm not sure if you are using OCCI or OCI (Oracle Call Interface - the C interface) since you reference "OCI_ATTR_DATA_TYPE" which is more of an OCI focus than OCCI.
    In any case, you might take a look at "OCI_ATTR_CHARSET_FORM" which takes the following values:
    #define SQLCS_IMPLICIT 1     /* for CHAR, VARCHAR2, CLOB w/o a specified set */
    #define SQLCS_NCHAR    2                  /* for NCHAR, NCHAR VARYING, NCLOB */So, if you have a datatype of SQLT_CHR and OCI_ATTR_CHARSET_FORM is SQLCS_IMPLICIT then you have a varchar2 if it is SQLCS_NCHAR then you have an nvarchar2.
    If you are using OCCI and not OCI then take a look at MetaData::ATTR_DATA_TYPE and MetaData::ATTR_CHARSET_FORM which expose OCI_ATTR_DATA_TYPE and OCI_ATTR_CHARSET_FORM respectively.
    Perhaps that will get you what you want.
    Regards,
    Mark

  • How to change the data type of an item in administrator

    Hi,
    A summary folder was created. One of the item in the summary folder is a sum. That sum item was created in the business area (based on another item). I can't refresh that summary folder because it gives me an oracle error (Ora-12008 and Ora-01401 the value is too large for the column). The column that this item is based on is of data type Number(13). How can I fix this problem without changing the column's data type of the original table? I already tried altering the data type in the EUL table via TOAD.
    Thanks!

    You really don't need to sum the item before hand if you are going to create a summary!

  • How to Change the data type of infoobject from NUMC to CHAR

    Hi Experts,
    I have created an infoobject with data type as NUMC, i used in DSO as a key figure and i have loaded data up to PSA.
    Now i want to change the data type of this Info Object from NUMC to CHAR.
    Can anyone suggest me the solution for this issue.
    Regards,
    Venu Gopal.K

    Hi pavan/binu,
    I have not loaded data into DSO i just added IO in Key fields and i started editing this IO then im facing error like
    1.Master Data Table /BIC/PZCUSTOMER contains data: Characteristic ZCUSTOMER cannot be activated     
    2.SID Table /BIC/SZCUSTOMER contains data: Characteristic ZCUSTOMER cannot be activated
    Im also unable to edit the P & S tables in SE14.
    NOTE:I have data only in PSA and when im trying to load data to DSO Im facing these issues.

  • How to change the data type in the table ESLL for the field USERF2_NUM ?

    Hello Friends,
    I have a requirement in which one of the change is to convert the data type of the field 'USERF2_NUM' in the table 'ESLL'  from 'QUAN' to 'CHAR'. 
    How do i do it if i have an access to change it..........i think i should also check the impact of the change if done.
    Kindly tell me as my requirement starts with this small change.
    Regards,
    Rajesh Kumar

    Thanks for the reply Sowmya.
    I would like to know 2 things.
    1. Is it ok to change the data type of the field 'USERF2_NUM '  which is in the table ESLL. from quan to char.
    2.  The table ESLL  already has entries. if we change the data type from QUAN to CHAR what is the  effect on the existing entries of the table .
    Kindly reply me back.
    Thanks & Regards,
    Rajesh Kumar

  • How to get the Data type of the Internal Table.

    How can i get the data types used to create an internal table
    TYPES : BEGIN OF t_makt,
              matnr    TYPE    matnr,
              maktx    TYPE    maktx,
            END OF t_makt.
    Like this some function will give me which data types i have used for the internal table at run time.

    Use the FM ..
    data : int_fcat type SLIS_T_FIELDCAT_ALV.
    REUSE_ALV_FIELDCATALOG_MERGE ..
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
           EXPORTING
                I_PROGRAM_NAME         = sy-repid
                I_INTERNAL_TABNAME     = 'IMAT'   <-- this is your internal table
                 I_INCLNAME             = sy-repid
           CHANGING
                CT_FIELDCAT            = int_fcat <--- this contains all the fields along with their characteristics ...
           EXCEPTIONS
                INCONSISTENT_INTERFACE = 1
                PROGRAM_ERROR          = 2
                OTHERS                 = 3.

  • Change the Data Type of a Standard Required Field

    Hello Experts,
    Need to know if is it possible to change the data type of a standard field. The field is marked as a required field.
    For example: If a standard field is an Object Picker and I would like to change it to a string field. Is it possible? How can I do it?!
    Many thanks,
    Igor Nakamura

    Hi Igor,
    Since you cannot hide a required field, what you can do is move the standard required field to someplace less noticable (like the bottom of the page) and then use a validation script to set it to some benign value.
    -Howie

  • Activation error while changing the data type of a field of a table

    hi friends,
    i am facing one problem while changing a data type of a field of a table.
    i just created one table(Yqm32) .i have assigned charcter data type to one field(ztotal_count) .now i want to change this charcter data type to numeric data type.
      while changing to NUMC data type activation error is comming as below.
    Table is not yet classified                           
    Field ZTOTAL_COUNT: Type change                       
      ALTER TABLE is not possible                         
    Structure change at field level (convert table YQM32) 
    Check on table YQM32 resulted in errors   
    Table YQM32 could not be activated                       
    (E- Structure change at field level (convert table YQM32)
    plz suggest.i need to change the data type from char to numc.
    Thanks & Regards

    Hi Pabitra......
    From the SE11 change the table as u wanted and then from menubar select
    UTILITIES--> DATABASE UTILITY
    It will open database utility
    there u select the Activate and adjust database button.
    then the database table will get adjusted.
    just try it once.........
    Suresh......

  • In the attached VI why does one loop coerce the data type while the other doesn't?

    In the attached VI why does one loop coerce  the data type while the other doesn't?
    Solved!
    Go to Solution.
    Attachments:
    AAA.vi ‏8 KB

    I'm guessing you created the Enum on the front panel.  If you right-click it and create an indicator, it will match the type, and be an enum.  LabVIEW represents enums as U16, but because the types aren't identical (for example, your enum has 3 values, but a U16 has 65,536 values), LabVIEW automatically coerces (or converts) the smaller (enum) representation into the larger (U16) value.

  • Smart Album : Inconsistency in the Date Type format used inside Aperture ?

    Hello,
    After using Aperture 2.0 for some days, I tried to create a Smart Album using as creation option for the Album the Date + "is in the Range" option which is leaving two blank fields for filling the two dates which are supposed to be the date limits of the pictures that the user wants to select.
    My OS X is set to the italian language so our date format is the dd/mm/yy type.
    When I tried to insert some dates in our format (dd/mm/yy) the SmartAlbum seemed to not work at all (not selecting any picture, or was coming out with weird results).
    After checking carefully that there was no filter set which could prevent the correct visualization of the pictures I had no explanation for the problem.
    At first I thought that this specific option was buggy as the other Smartalbum creation options (Keywords etc.) seemed to work properly.
    Then I had the idea and I tried to use the english format (mm/dd/yy) for the two dates inside the date range fields and to my surprise everything worked properly.
    So basically it seems that Aperture recognises the dates correctly only giving in input the american date format mm/dd/yy.
    What is not so noice is that there is no check on the date limit correctness so basically it is possible to really mess up with the dates.
    I'm also actually surprised the Aperture doesn't complies with the OS X date type which could seem the logical thing to do or at least is not consistent with the date type management inside the program because for example the pictures Dates are instead correctly listed in the List View of the browser according to the OS X date type (dd/mm/yy).
    I was wondering what is happening in countries where the date separator is not the "/" but the "." like typically used in Germany which would add another variable to the software routine which is interpreting the date input fields.....
    Maybe this could help other non english users who could have been confused like me on the same issue....
    Did you notice the same behaviour ? Am I missing something ?
    Uby

    Smart Albums will search in the Folder/Project that is shown at the top of the search HUD as well as all Folders and Projects "below" in your structure. However, it will not search through any Albums in that structure. Here is an example:
    You images are always stored in Projects (yellow icons) and lets say this is how it looks:
    FolderA/ProjectA (this Project stores: ImageA1, ImageA2)
    FolderA/ProjectB (this Project stores: ImageB1, ImageB2)
    Let us say that you have two Albums like below but there is an image from ProjectB in AlbumA, which looks like this:
    FolderA/ProjectA/AlbumA (this Album has pointers to: ImageA1, ImageA2, ImageB1)
    FolderA/ProjectB/AlbumB (this Album has pointers to: ImageB1, ImageB2)
    If you create a Smart Album below ProjectA it will only show ImageA1 and ImageA2 since it only search ProjectA and not AlbumA.
    This may be the issue you have.
    Are you 100% sure that the Project your Smart Album is pointing at does include the images you are trying to search through. As you see above then it won't find them if they are only in the albums below that project.
    Here are a few rules that I follow in order to avoid getting confused over where my images are located: A) Only include images in albums below a project that are stored in that project. B) Create all my smart albums at top library level and if necessary add extra filters like project name.
    Hope you understand.
    Karsten

Maybe you are looking for

  • Animated gif not moving, image.animation_mode already set to Normal

    ''dupe of - https://support.mozilla.org/en-US/questions/932846 - locking'' With image.animation_mode already set to Normal, animated gif are not moving, it seems only the first frame is downloaded. I tried downloading the image, it also seems that on

  • Error while modifying HR infotype PA0105 using HR_INFOTYPE_OPERATION

    Hello All, I am not able to modifying the infotype PA0105. Currently I am using the FM HR_INFOTYPE_OPERATION. But I am not able to modify the record. Has anyone faced any such situation... Please help..!! Useful pointers will be appreciated... Thanks

  • 9i merge statement

    Is anyone aware of how to "add a contraint" to the update section of the merge statement to constrain which records are updated? The "on" statement is basically a join, but in typical update statements, you can add a "where" to constrain which record

  • Hand-me-down computer with iTunes already on it

    I just bought pops old computer and it already has iTunes and metric tonne of music. Is there a way to get my iTunes into his computer without loosing his music or mine. Basically I'm asking if I can have it all.

  • Flash player not installed (but it is)

    I have recently upgraded to Mavericks and the latest version of safari. I went to open a website and it told me that I need to install flash player, however I already have the lastest flash player installed. I checked in the preferences for safari an