Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2004
    Location
    Las Vegas, NV USA
    Posts
    38

    Unanswered: Leading zero's in Oracle Forms tricky

    I got a tough one, at least for me. In Oracle Forms 10g I am trying to take number from three items, and combine them into one item for a Job_id. Here is what its like:

    Vessel Number 3 digits ex 156
    Run Number - 3 digits ex 023
    Segment Number 2 digits ex 01

    What gets placed in the Job_id item on a PRE-INSERT is 156-023-01. That's what I want. Instead I get 156-23-1. Now, the run number and segment fields I setup a format mask like 099 to show the zero, but in the PRE-INSERT the zero's still go away. I've tried everything messing with the FORMAT MASK in job_id and nothing.

    Any Suggestions.
    Thank you,
    Todd
    Todd Farino
    Timet Corporation
    todd.farino@timet.com

  2. #2
    Join Date
    Jan 2004
    Posts
    492
    I really dont know forms well, but is there anyway you could throw an lpad in the query which pulls segment number?

    Like
    Code:
    Select lpad(segment_number, 2, 0)
    from table
    Just a stab here!
    Oracle OCPI (Certified Practicing Idiot)

  3. #3
    Join Date
    May 2004
    Location
    Dominican Republic
    Posts
    721
    Try format Mask 'FM000' or as many/lesses zeros you need (FM fill mode).

    Example:
    Code:
    SQL> ed
    Wrote file afiedt.buf
    
      1  create table t (
      2   Vessel Number,
      3   Run Number,
      4   Segment Number
      5* )
      6  /
    
    Table created.
    
    SQL> insert into t values (156,023,01);
    
    1 row created.
    
    SQL> select * from t;
    
        VESSEL        RUN    SEGMENT
    ---------- ---------- ----------
           156         23          1
    
    SQL> select to_char(vessel,'FM000') || '-' || to_char(run,'FM000') || '-' || to_char(segment,'FM00')
      2    from t
      3  /
    
    TO_CHAR(VESSE
    -------------
    156-023-01
    
    SQL>

  4. #4
    Join Date
    Jan 2004
    Location
    Las Vegas, NV USA
    Posts
    38
    Thank you, I will give that a try today.

    Todd
    Todd Farino
    Timet Corporation
    todd.farino@timet.com

Posting Permissions

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