How to specify precision and scale for a datatype in create procedure statement

Specifying precision and scale in the datatype when creating a procedure does not work:
create or replace function SqlTxFunctionTesting(inparam in number(9,2)
Error(1,48): PLS-00103: Encountered the symbol "(" when expecting one of the following: := . ) , @ % default character The symbol ":=" was substituted for "(" to continue.

user4928701 wrote:
Specifying precision and scale in the datatype when creating a procedure does not work:
create or replace function SqlTxFunctionTesting(inparam in number(9,2)
Error(1,48): PLS-00103: Encountered the symbol "(" when expecting one of the following: := . ) , @ % default character The symbol ":=" was substituted for "(" to continue.
And one of the cons in the PL/SQL language in my view.
The language does not allow parameters to be declared in the fashion you are attempting to. Even declaring a subtype and using that, does not enforce either the precision or scale, on the parameter value passed.
Even worse - the parameter value can be a different data type all together from the defined parameter type - and a silent and implicit data type conversion will be done at run-time.
So you can expect run-time errors in your code unit caused by the caller passing invalid values, despite the compiler okaying the call from the caller to your code.
There are pros and cons to this approach. But if you are from a very strong type language environment like C or Pascal, you tend to see more cons than pros in this specific case.

Similar Messages

  • Precision and scale for numeric datatypes

    Could be in XSU, could be in Oracle thin driver, but I'd expect the SAL column of the EMP table to include its precision and scale, e.g. 800.00 and not 800.
    oracle: decribe EMP
    NAME TYPE
    SAL NUMBER(7,2)
    sql server: sp_help EMP
    Column_name Type Length Prec Scale
    SAL numeric 5 7 2
    sql server:
    java myOracleXML getXML -conn "jdbc:inetdae7:aetius:1433?database=Northwind" -user "sa/sa" "select SAL from EMP where EMPNO > 7999"
    <?xml version = '1.0'?>
    <ROWSET>
    <ROW num="1">
    <SAL>800.00</SAL>
    </ROW>
    </ROWSET>
    oracle:
    java OracleXML getXML -user "scott/tiger" "select sal from
    emp where empno > 7999"
    <?xml version = '1.0'?>
    <ROWSET>
    <ROW num="1">
    <SAL>800</SAL>
    </ROW>
    </ROWSET>
    So who loses the scale in the Oracle case, the driver or XSU.
    Steve.

    user4928701 wrote:
    Specifying precision and scale in the datatype when creating a procedure does not work:
    create or replace function SqlTxFunctionTesting(inparam in number(9,2)
    Error(1,48): PLS-00103: Encountered the symbol "(" when expecting one of the following: := . ) , @ % default character The symbol ":=" was substituted for "(" to continue.
    And one of the cons in the PL/SQL language in my view.
    The language does not allow parameters to be declared in the fashion you are attempting to. Even declaring a subtype and using that, does not enforce either the precision or scale, on the parameter value passed.
    Even worse - the parameter value can be a different data type all together from the defined parameter type - and a silent and implicit data type conversion will be done at run-time.
    So you can expect run-time errors in your code unit caused by the caller passing invalid values, despite the compiler okaying the call from the caller to your code.
    There are pros and cons to this approach. But if you are from a very strong type language environment like C or Pascal, you tend to see more cons than pros in this specific case.

  • Specifying precision and scale

    Hello,
    I have a table that was created with a column pfixed NUMBER(38). The data contains up to 16 numbers after the decimal point (e.g. <pfixed>4.8283510208129883</pfixed>). XSU loads it with scale of 0, which results in everything after the decimal being truncated. The precision is correctly set to 38, to match the NUMBER column.
    Is this a problem with the create table statement, or is there a way to tell XSU what scale to use?
    Thanks,
    Leila

    i'm not sure if i understand your problem..
    you say you (or someone else) declared a
    table with NUMBER(38) and you want 0.??? written to it (or from ??)...
    then why not declare your own precision
    ( format NUMBER(a,b)
    where a is size and b is precision)
    assume the number xxx.yyyy
    format NUMBER(2,4) stores xx.yyyy
    format NUMBER(1,2) stores x.yy
    format NUMBER(3,1) stores xxx.y
    38 is NOT your precision, it's SIZE !!
    i hope this helps...
    null

  • Precision and Scale in NUMBER datatype

    In oracle, if you want to store a number like 892.34, you need to declare the NUMBER type like
    number(5,2)Here 5 stands for the total number of digits including the numbers after the decimal point.
    2 stands the number of digits to the right of the decimal.
    Isn't this confusing? Can't they just make the syntax like
    number(3,2)where 3 is the number of digits from left till the decimal and 2 is the number of digits after the decimal.

    create table t ( n number( 6, 5 ) ) ;
    alter table t add constraint c check ( n between 0.00001 and 0.1 ) ;
    invalid value will throw
    SQL Error: ORA-02290: check constraint (SYS.C) violated
    *Cause:    The values being inserted do not satisfy the named check          
    *Action:   do not insert values that violate the constraint.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • What is the point of Precision and Scale in Number Type?

    Version :11.2
    What is the point in having PRECISION and SCALE in number type? If you create the column with just NUMBER ie.without
    specifying precision or scale , you can enter numbers with any precision and scale.
    SQL> select * From v$version where rownum < 2;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    SQL> create table t1 (col1 number);
    Table created.
    SQL> insert into t1 values (223.9939394);
    1 row created.
    SQL> insert into t1 values (88.228384);
    1 row created.
    SQL> insert into t1 values (9.34);
    1 row created.
    SQL> insert into t1 values (000.00);
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> select * from t1;
          COL1
    223.993939
    88.228384
          9.34
             0Did you ever have a business scenario where a Numerical column should store values only with a fixed precision and scale ?

    Omega3 wrote:
    Version :11.2
    What is the point in having PRECISION and SCALE in number type? If you create the column with just NUMBER ie.without
    specifying precision or scale , you can enter numbers with any precision and scale.
    SQL> select * From v$version where rownum < 2;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    SQL> create table t1 (col1 number);
    Table created.
    SQL> insert into t1 values (223.9939394);
    1 row created.
    SQL> insert into t1 values (88.228384);
    1 row created.
    SQL> insert into t1 values (9.34);
    1 row created.
    SQL> insert into t1 values (000.00);
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> select * from t1;
    COL1
    223.993939
    88.228384
    9.34
    0Did you ever have a business scenario where a Numerical column should store values only with a fixed precision and scale ?Lots of business requirements for specific precisions and scales.
    A persons Age may required to be stored as whole numbers of no more than 3 digits.
    A sum of money may required to be stored with no more than 2 decimal places of accuracy e.g. GB Pounds and Pence or US Dollars and Cents
    A unit of length may required to be stored in metres with 2 decimal places for centimetres
    A shoe size may be required to be stored with one decimal place for half sizes
    etc.
    etc.
    Yes, you may just create all of them as generic NUMBER datatype, but creating them with precision and scale can provide additional information about the limitations expected for the values stored, especially for things like reporting tools that may use the specified precision and scale to determine how to display the values automatically (by default).
    If you start questioning "what's the point?" then you may as well say what's the point in having a NUMBER datatype when we can store numbers in a VARCHAR2 datatype? or what's the point in having a DATE datatype when we can stored dates as VARCHAR2 datatype? etc.
    No point in asking such a question because there's almost always a point to these things (and if there isn't they get deprecated in later versions).

  • Can I know the precision and scale of a decimal field using ACEDAO?

    Using ACEDAO in VC++, I am trying to retrieve the field details of an Access database (.accdb file) table of which one field is of decimal type. I am able to get the details using the functions of
    DAO::_FieldPtr field;
    as follows:
    fieldName = field->GetName().GetBSTR();
    nType = field->GetType() // returns DAO::dbDecimal
    lSize = field->GetSize(); // returns 16
    lAttr = field->GetAttributes(); // returns 0x000002H
    nOrdinal = field->GetOrdinalPosition(); // returns 11
    bAutoIncrement = ((lAttr & DAO::dbAutoIncrField) > 0);
    DAO::PropertiesPtr props;
    DAO::PropertyPtr prop;
    int k, nProp;
    std::wstring propName, propNames;
    props = field->GetProperties();
    if(props)
    nProp = props->GetCount(); // returns 33
    for(k = 0; k < nProp; k++)
    prop = field->GetProperties()->GetItem((short) k);
    if(prop)
    propName = prop->GetName().GetBSTR();
    propNames += propName;
    propNames += L"\n";
    // After exiting the loop, propNames contain 33 properties as:
    // Value
    // Attributes
    // CollatingOrder
    // Type
    // Name
    // OrdinalPosition
    // Size
    // SourceField
    // SourceTable
    // ValidateOnSet
    // DataUpdatable
    // ForeignName
    // DefaultValue
    // ValidationRule
    // ValidationText
    // Required
    // AllowZeroLength
    // AppendOnly
    // Expression
    // FieldSize
    // OriginalValue
    // VisibleValue
    // GUID
    // ColumnWidth
    // ColumnOrder
    // ColumnHidden
    // Description
    // DecimalPlaces
    // DisplayControl
    // TextAlign
    // AggregateType
    // ResultType
    // CurrencyLCID
    //But does not have any property named "Scale" or "Precision"
    I could not find any function for retrieving the value for precision and scale for the decimal field.
    Though I am able to retrieve the field value as a decimal number and get the required information from the structure, I think it is not the right way. Because, what will happen if the data for field is not available in the table?
    Is there any other method to retrieve the precision and scale of a decimal type field using ACEDAO?
    Thanks.

    I cannot find a method or property in ACEDAO to retrieve the precision and scale of a field. Maybe you could try get the number of a decimal type and use some mathematical methods to get the precision.
    I find there are some way to get the precision by ADO or OLEDB.
    For ADO way, you could check this thread:
    https://social.msdn.microsoft.com/Forums/office/en-US/883087ba-2c25-4571-bd3c-706061466a11/how-can-i-programmatically-access-scale-property-of-a-decimal-data-type-field?forum=accessdev
    For OLE DB , you could use IColumnsInfo::GetColumnInfo to get DBCOLUMNINFO::bPrecision.
    https://msdn.microsoft.com/en-us/library/windows/desktop/ms722704(v=vs.85).aspx
    Also people in C++ may not familiar with access development, the
    Access for Developers forum is good place for access develop issue. You could try there.
    Hope this helps some.
    Shu
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Precision and Scale

    I am creating some application tables with APEX. When i define a column on my table for primary or foreign keys I select the NUMERIC datatype. The form then prompts me for Precision and Scale. What are the recommended values for precisions and scale for key columns? I understand that precision is the total number of digits before and after the radix but what is meant by scale - the number of digits after the radix? I'm a little rusty on these issues as it has been a long time since I used them.
    Thanks, Ned

    Hi
    Just to add to this (definitions spot on though as Paul pointed out)...
    'NUMERIC' is not an Oracle datatype. The datatype is NUMBER. Oracle supports NUMERIC in a create statement but it is stored as NUMBER under the hood.
    Using precision and scale definitions is not necessary, you can define number just on it's own and it will handle what you throw into it. The design consideration comes into exactly what you are going to use the field for.
    I came across a situation where a company were creating their administration system (and this was a reasonably large company with some very important data) and had decided to use NUMBER(9) for the PK ID column on all their major tables. Sure enough, 10 years later this started to cause a problem cause the were running out of numbers! (okay, this is no big deal to fix but it's just an example). The reasoning had originally been because Oracle Forms defaulted the display field length to that in the data dictionary it would save them the effort of changing it manually every time they created a new form!
    I generally define NUMBER as NUMBER unless there is a valid rule to say that it is and always be something that can be defined. For example monetary amounts - Japanese Yen can't have decimals so it should be held in a NUMBER (10,2) field (although lots of people do this for their 'amount' columns anyway). The data rules.
    Cheers
    Ben
    http://www.munkyben.wordpress.com
    Don't forget to mark replies helpful or correct ;)
    Edited by: Munky on Aug 19, 2009 8:01 AM

  • How can I move and scale my photos

    How can I move and scale my photos so that I can use them for wallpaper?  After update, I'm no longer able to do this as much as I need to.  They just pop back to their original size or larger.

    You will either need to turn Settings > General > Accessibility > Reduce Motion 'on', or create a higher resolution versions of your images
    From http://support.apple.com/kb/HT5595 :
    When the parallax effect is on, you may notice the following:
    Wallpaper, icons, and alerts shift slightly as you move your phone.
    When you set a wallpaper in Settings > Wallpapers & Brightness, the photo or image will be slightly zoomed and can't be scaled to fit the screen.
    If you zoom in, you will need to rescale your wallpaper to fit to the screen. You can't rescale certain photo formats, including landscape or square images.

  • So how to specify different answer file for different install images in WDS snap-in?

    hello
    in WDS snap-in, in properties on server name, on client tab, we can define an answer file for unattended windows installation on WDS clients.
    my question is, maybe we have added multiple images in WDS snap-in (win xp image, win 7 , win 2008,...)
    now this one answer file applies to all of them ?
    so how to specify different answer file for different install images in WDS snap-in?
    thanks in advanced 

    Under the "Client" tab of WDS, you should only use an answer-file with settings relevant for the installation. This would be credentials for the WDS deployment share, international settings used during the setup and possibly also destination drive
    details (if you want the installation to take care of partitioning the disk etc). The settings relevant for unattend-files used under "Client" would only be of those in phase 1 (WinPE).
    However, if you would like to have specific unattend file for every installation, e.g. Win7, Server 2008, Win 8 etc, you can browse to the image under "Install Images" under the image Groups. There you can select properties for every image and
    have a personal unattend-file.
    hi Joel
    very cool. thanks a lot, that really helped me.
    best regards

  • How do I move and scale pictures on iPad mini

    How do I move and scale pictures on I pad mini I can move but not scale

    You can go into the settings, accessibility and turn parallax motion off. THis is what makes it look 3D, like your icons are floating on your screen. It helps a bit because to have that 3D, your wallpaper needs to have an overlap off the edge of the screen.
    ALso, if you go into the photos app, find your photo, send it to be wallpaper (the box with the arrow poking out of it) you will have a bit more control. The higher resolution your image is the more you will have.
    Some have also reported some progress rotating their image. For example if your picture is landscape (wider than it is tall), when you go into the photos app, hold your iPad in portrait mode, taller than it is wide. Do the send to that way and see if it helps with you having more scaling room

  • Validation of numeric value precision and scale

    Hi all,
    Iam using ADF with EJBs.
    I have one inputText field that will accept numeric values (of java.lang.Double type). Due to database constraints I want to validate the input value on its precision and scale.
    I put an f:convertNumber tag under the inputText and set the MaxIntegerDigits and MaxFractionDigits properties with the desired values.
    I also set the ApplyValidation property of the corresponding attribute in the pagedef file. However no validation worked.
    I made the same test with af:ConvertNumber with no result too.
    I know that with BC4J it is easy to set such constraints at the entity level.
    Is there any neat way to set validation or I need to write code in the backing bean?

    <af:convertNumber> works fine for me. see the following code
    <af:inputText id="it1">
    <af:convertNumber type="number" minFractionDigits="2" maxIntegerDigits="4" maxFractionDigits="2"/>
    </af:inputText>
    Another possible solution with regular expression
    <af:inputText id="it3" value="9999.99">
    <af:validateRegExp pattern="\[0-9\]\[0-9\]\[0-9\]\[0-9\].\[0-9\]\[0-9\]"/>
    </af:inputText>
    regards
    srini
    Edited by: sangara on Jan 17, 2010 9:53 PM

  • How to find classtype and class for a material.

    Hi,
    How to find classtype and class for a material.
    which table contains this data.
    Thanks
    Kiran

    Hi Kiran,
    Check below sample code. Use this BAPI which will give all info about the class for the material.
      DATA:      l_objectkey_imp    TYPE bapi1003_key-object
                                         VALUE IS INITIAL.
      CONSTANTS: lc_objecttable_imp TYPE bapi1003_key-objecttable
                                         VALUE 'MARA',
                 lc_classtype_imp   TYPE bapi1003_key-classtype
                                         VALUE '001',
                 lc_freight_class   TYPE bapi1003_alloc_list-classnum
                                         VALUE 'FREIGHT_CLASS',
                 lc_e               TYPE bapiret2-type VALUE 'E',
                 lc_p(1)            TYPE c             VALUE 'P',
                 lc_m(1)            TYPE c             VALUE 'M'.
      SORT i_deliverydata BY vbeln posnr matnr.
      CLEAR wa_deliverydata.
      LOOP AT i_deliverydata INTO wa_deliverydata.
        REFRESH: i_alloclist[],
                 i_return[].
        CLEAR:   l_objectkey_imp.
        l_objectkey_imp = wa_deliverydata-matnr.
    *Get classes and characteristics
        CALL FUNCTION 'BAPI_OBJCL_GETCLASSES'
          EXPORTING
            objectkey_imp         = l_objectkey_imp
            objecttable_imp       = lc_objecttable_imp
            classtype_imp         = lc_classtype_imp
    *   READ_VALUATIONS       =
            keydate               = sy-datum
            language              = sy-langu
          TABLES
            alloclist             = i_alloclist
    *   ALLOCVALUESCHAR       =
    *   ALLOCVALUESCURR       =
    *   ALLOCVALUESNUM        =
            return                = i_return
    Thanks,
    Vinod.

  • How to remove bullets and spacing for url links in the Related Links iview?

    I tried to look for a property that I can edit the look-n-feel of the url links in the Related Link iView using "Theme Editor".
    All I need is to remove the bullets and increase some vertical spacing between the links.
    Currently, it looks like this:
    URL iView A
    URL Iview B
    I go through the whole section of Related Links properties, none of them seems to do what I want.
    Here are the list of properties in Related Link section (of Navigation Panel):
    Link Color
    Text Decoration of Link
    Hover Color
    Text Decoration of Hovered Link
    Initially, I thought "Text Decoration of Link" should be the right property I should look at. But there are a drop-down with 5 options: None, Underline, Blinking, Overline and Line-Through, which really can't achieve what I want.
    Thanks for advice.
    Kent
    Post with Diagram Illustration:
    <a href="http://sapnetweaverforum.blogspot.com/2006/11/how-to-remove-bullets-and-spacing-for.html">How to remove bullets and spacing for url links in the Related Links iview?</a>
    Message was edited by: Kent C.

    Hi, Kai.
    I checked the Related iView properties (URL Template), I don't see what layoutset it is really using. I am not sure, is that a layout set apply to the Related Link Iview?
    For the regular KM iView, I will see what Layout Set I want to apply, then I can go and change the properties (of layout coontroller, collection renderer & resource renderer)you mentioned. But for this Related Link iView, I really don't know. I guess it may be in the code itself.
    If there is a layout set for Related Link iView (or the place to apply layout set to it), can you point to me which one is that? (I did a search through the layout set names, I only find the AppQuicklinkExplorer (I used this for Dynamic Nav. Link iView before), if I can aply this layout set to Related Link iView, my problem will be solved.)
    Thanks for help.
    Kent

  • HOW TO FIND WF_ITEM_TYPE AND WF_ITEM_KEY FOR PO

    제품 : MFG_PO
    작성날짜 : 2003-05-14
    HOW TO FIND WF_ITEM_TYPE AND WF_ITEM_KEY FOR PO
    ===============================================
    PURPOSE
    This solution is for Oracle Purchasing 11 and higher
    Explanation
    1. Start a SQL*Plus session using the APPS schema.
    2. Run the following script and enter the Purchase Order number that is stuck
    in process when prompted for the PO_NUMBER:
         SELECT WF_ITEM_TYPE, SUBSTR(WF_ITEM_KEY,1,25) "WF_ITEM_KEY"
         FROM PO_HEADERS_ALL
         WHERE AUTHORIZATION_STATUS='IN PROCESS'
         AND SEGMENT1='&PO_NUMBER';
    3. If more than one row is returned, then run the following script and only
    refer to the row that contains the OPERATING_UNIT_NAME that equals the
    operating unit name tied to the responsibility used when the Purchase Order was
    discovered as being stuck in process.
         SELECT SUBSTR(WF_ITEM_TYPE,1,12) "WF_ITEM_TYPE",
         SUBSTR(WF_ITEM_KEY,1,15) "WF_ITEM_KEY",
         SUBSTR(NAME,1,35) "OPERATING_UNIT_NAME"
         FROM PO_HEADERS_ALL PA, HR_ORGANIZATION_UNITS OU
         WHERE PA.ORG_ID=OU.ORGANIZATION_ID
         AND AUTHORIZATION_STATUS='IN PROCESS'
         AND SEGMENT1='&PO_NUMBER';
    Example
    Reference Documents
    -------------------

    Hi Kishore,
    Welcome to SCN!
    to find the sales order from Purchase order , go to SE16, Enter the table name as VBAK and press Enter.
    In BSTNK field of VBAK, Enter the Purchase order number. System will return you corresponding sales order.
    Hope this will help you.
    Regards,
    Nikhil

  • How to download drivers and software for hp pavilion dv6-3127tx . product unable to search

    How to download software and drivers for HP Pavilion dv6-3127TX. Unable to search the product in help and support center.
    Mohan Singh

    Hi,
    I can't find a listing for this model either, but you should find the drivers available on the link below work.
    http://h20000.www2.hp.com/bizsupport/TechSupport/DriverDownload.jsp?prodNameId=4331848&lang=en&cc=us...
    Regards,
    DP-K
    ****Click the White thumb to say thanks****
    ****Please mark Accept As Solution if it solves your problem****
    ****I don't work for HP****
    Microsoft MVP - Windows Experience

Maybe you are looking for

  • Pass lock to background job

    Hi, I'm looking for ideas. We have an inbound process for special messages transfered from XI system via asynchrounous call. Messages are identified by a GUID. The inbound process will save the messages in a database table and create background jobs

  • How can I add vocal effects other than the 9 Voice options? (I can't shift pitch)

    Hello! I am making the switch from PC and am just trying to lower the pitch of a vocal track by at least an octave; I just got a MBP last week and am running GB 10.0.2. I can't find any info on similar problems that is helpful; most solutions I've co

  • Ship to party and sold to party changes to same value in VA01 while saving

    Hi Team, In VA01 transaction, i am trying to create an Order with oen Order Type. Now in the second screen, if i give the ship to party as 123 and the Sold to party as 456 and if i give an item number and material number with quantity something and i

  • Using jGrasp for a compiler

    Im using jGRASP to compile all the java stuff. I would like to use it as well to compile all my C++ stuff as well. I can not get it to read though. I get some errors that i cant seem to get fixed anyone know how to get JGrasp to compile C++

  • Why will my Numbers 2.1 not open?

    Why will my Numbers 2.1 not open since I have updated my OS to 10.6.8?