Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2002

    Question Unanswered: converting Data-types in Oracle Forms 4.5

    I have a field on a form called "year", its data type is NUMBER. I want to define a range for this item to be between 1950 and the current year. To achieve the upper end of the range, I use the entry below, however, I get an error (FRM-11324 "value is invalid"). It won't let me define the upper end of the range in this manner

    TO_NUMBER(SUBSTR((TO_CHAR($$DATE$$, 'dd-mon-yyyy')), 8, 4))

    Any thoughts on what the problem is?

  2. #2
    Join Date
    Aug 2003
    Where the Surf Meets the Turf @Del Mar, CA
    Provided Answers: 1
    To_number(to_char($$date$$, 'yyyy'))
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    Aug 2002
    Is that not what I have already written? ... i.e. a date converted to a number?

  4. #4
    Join Date
    Jan 2004
    Croatia, Europe
    Provided Answers: 4
    It is quite simple: when in item Property Palette, click in to the "Highest Allowed Value" and press F1 (Help). You'll see something like this:
    The following values are valid for range settings:
    - any valid constant form item (:block_name.item_name)
    - global variable (:GLOBAL.my_global)
    - form parameter (:PARAMETER.my_param)
    Your "TO_NUMBER(SUBSTR((TO_CHAR($$DATE$$, 'dd-mon-yyyy')), 8, 4))" isn't among them; that's why you got
    FRM-11324: Value is invalid.

    Cause: The value you entered is out of the legal range.

    Action: Enter a legal value.
    So, you could, for example, create a global variable in a WHEN-NEW-FORM-INSTANCE trigger which would look like this:
    select '1950'        , to_char(sysdate, 'yyyy')
    into :global.low_year, :global.high_year
    from dual;
    Then you'd put those variables as lowest (:global.low_year) and highest (:global.high_year) allowed values.

    If you ask why aren't populated using the TO_NUMBER function, here's why: global variables are CHARACTERS; no matter what you put into them, they will still be characters.

    Therefore, if you'd want to put it properly, perhaps you should use parameters instead of global variables. I wan't in the mood do do it.

    P.S. This is based on Oracle 10g Forms Developer; it may differ from your version, but should be close enough for you to get the general idea.

  5. #5
    Join Date
    Aug 2002
    Thanks LF.. much appreciated

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts