Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2003
    Posts
    35

    Unanswered: Need formatting Help (converting from sql to pl/sql)

    I'd like to convert some queries I have from SQL into PL/SQL, but I fear the formatting and column headers will not work in PL/SQL. Is there a cheap and easy way to do the Column Headers and stuff?
    "My Idea is that everyone should be required to use small fonts. That way we'll save disk space.
    ~Asok.

  2. #2
    Join Date
    Jan 2004
    Posts
    492

    Re: Need formatting Help (converting from sql to pl/sql)

    Originally posted by okiiyama
    I'd like to convert some queries I have from SQL into PL/SQL, but I fear the formatting and column headers will not work in PL/SQL. Is there a cheap and easy way to do the Column Headers and stuff?

    I assume by SQL you mean SQL*PLUS. If you are looking to produce reports, you really should look into buying the Oracle Development package 9i. It contains Oracle Reports, which allows you to produce pretty much any report you're going to need. You can also use column headers and whatever other labels you want.

    Although I dont know your requirements, if you can do anything in straight SQL, dont do it in PL/SQL. PL/SQL gives you a little more flexibility in coding, but it does NOT run as fast as straight SQL.

    Just something to chew on.

  3. #3
    Join Date
    Jan 2003
    Posts
    35

    Re: Need formatting Help (converting from sql to pl/sql)

    This is a homework assignment actually. Where we made 5 queries in SQL PLUS and now we need to do them in PLSQL. So that means all my nice formatting is out the window, and I was just wondering if there was a way that PLSQL somehow has column formatting.
    "My Idea is that everyone should be required to use small fonts. That way we'll save disk space.
    ~Asok.

  4. #4
    Join Date
    Apr 2003
    Location
    NY
    Posts
    208

    Re: Need formatting Help (converting from sql to pl/sql)

    You will loose your column formatting. That is a feature of SQL-Plus. But you can manually format the data.

    Code:
    DECLARE
       lv_OrderDate  DATE                   := SYSDATE;
       lv_PartNum     VARCHAR2(10)    := 'A109G46';
       lv_Price          NUMBER(9,2)        := 34.95;
       lv_Title           VARCHAR2(250);
       lv_Output       VARCHAR2(250);
    BEGIN
    
       lv_Title  := Rpad('Part Number',25,' ')||
                    Rpad('Order Date',25,' ')||
                    'Price';    
    
       lv_Output := RPad(lv_PartNum,25,' ')||
                    RPad(To_Char(lv_OrderDate,'MM/DD/YYYY'),25,' ')||
                    '$'||lv_Price;
    
       DBMS_OUTPUT.PUT_LINE(lv_title);
       DBMS_OUTPUT.PUT_LINE(lv_Output);
    END;

  5. #5
    Join Date
    Apr 2003
    Location
    NY
    Posts
    208

    Re: Need formatting Help (converting from sql to pl/sql)

    Sorry, forgot to paste the output.

    Part Number Order Date Price
    A109G46 03/29/2004 $34.95

  6. #6
    Join Date
    Apr 2003
    Location
    NY
    Posts
    208

    Re: Need formatting Help (converting from sql to pl/sql)

    Lets try that 1 more time ( lost the formatting)

    PHP Code:
    Part Number              Order Date               Price
    A109G46                   03
    /29/2004               $34.95 

Posting Permissions

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