Formatting Output from a procedure

Hi all,
I want to format the output of this procedure
declare
cursor c1 is select tname from tab where tabtype = 'TABLE' ;
tabname varchar2(1000) ;
i number := 1;
rc number ;
str varchar2(1000) ;
begin
open c1 ;
loop
fetch c1 into tabname ;
exit when c1%notfound ;
str := 'select count(*) from ' || tabname ;
execute immediate str into rc ;
dbms_output.put_line(i || ' - ' || tabname || ' -- ' ||rc) ;
i := i + 1 ;
end loop ;
close c1 ;
end ;
The OUTPUT is like this.......
1 - asdf -- 0
2 - asdfsdafasdf -- 16
3 - asdfsaf -- 327
4 - asdfasdfasfsdafsdfs -- 27
5 - asd -- 128562
Now, I want this output should be like this
1 - asdf -- 0
2 - asdfsdafasdf -- 16
3 - asdfsaf -- 327
4 - asdfasdfasfsdafsdfs -- 27
5 - asd -- 128562
Thanks in advance,
Pal

Use [ pre ] and [ /pre ] with no sapce.
http://www.oracle.com/technology/forums/faq.html#q14
But,for your question, using to_char or lpad, you can format.
dbms_output.put_line(i || ' - ' || tabname || ' -- ' ||lpad(rc,20)) ;
-- Oops, I correct as following.
dbms_output.put_line(rpad(i || ' - ' || tabname || ' -- ' ,60)||lpad(rc,20)) ;
Message was edited by:
ushitaki

Similar Messages

  • How to get XML format output from Hyperion Financial Reporting

    Dears,
    We are using Hyperion Financial Reporting to replace FSG in fusion. I found that Hyperion FR report can be exported to html/excel/pdf format. However, I would like the report to export to xml format.It means I only need the xml data source.
    Anyone who knows how to get the xml format output from Hyperion FR, is there any avaiable API?

    I think if you export the report, you will be able to open the .des file in Notepad/Wordpad and see xml content.

  • How do I read a report's XML Output from a procedure?

    I am using E-Business suite 11.5.10.2 and XMLP 5.5. I have a report that will output XML. When this report is run, I can click the 'View Output' button and view the XML. This appears to be a temp file somewhere, because the temp id in the URL changes each time a new report is run. Here's my problem: After running this report, I want to execute a procedure that will loop through the XML output and transform it into HTML. I will then output this HTML to the screen. But I'm not sure how to pass this file as a parameter to my procedure.
    Is there anyway to allow a procedure to consume the XML output?
    The reason I'm trying to do this, is because we need to transform certain reports into Excel format. This is becoming a critical issue. After testing, I found that if I can extract data into an HTML table and display it on the screen, it dumps perfectly into Excel. I tested it using a cursor, but that won't work for production reports. There is a ton of logic built into these Oracle reports, so I need to go the XML route after running the report.
    Looking at previous posts, the current Excel output process seems to be a bit buggy. And, we can not upgrade to Excel 2003 at this time.
    Any ideas would be greatly appreciated!!!
    Thanks.
    Mark K

    Hello Klaus. I appreciate your response. While I'm no expert with XMLP, I have created about 8 production reports using XMLP. I am using XMLP 5.5, and not 5.6.1 I am using Excel 2002 and not Excel 2003. From other posts (shown below), it is my understanding that the Excel output may have bugs unless you're using XMLP 5.6.1 and Excel 2003.
    Please see the following posts for more information:
    Re: EXCEL output not displaying properly
    Excel output in 5.6 version
    Also, when I tried to output to Excel using my desktop version, I received an error message. But, when I switch to PDF format, it opens just fine.
    We are not prepared to upgrade Excel and/or install another patch for XMLP at this time. If I can do what I need to do programmatically, I will have much more leverage when it comes to troubleshooting. On the other hand, when I run into a bug with Oracle software, I usually have to wait for a patch.
    Thanks again.
    Mark K.

  • A litttle help formatting output from powershell?

    Hi all, I am working on a software inventory project and am (as will become obvious) a novice at powershell.  I have the script running so I get what I need, but the formatting is borderline un-useable.  I would like to see if anyone can point
    me in the direction of creating one or two of the following: a single, collated file of all installed programs on all computers in the OU, filtered for duplicates (ie, only unique entries, not 37 instances of Office 2010 Service Pack 2), and/or an excel worksheet
    with a page for each pc in the OU, and the list of installed programs on each page.  This is what I have so far:
    $rtn = $null
    Get-ADComputer -filter '*' -searchbase 'ou=levy chd, dc=doh,dc=ad,dc=state,dc=fl,dc=us'|
    ForEach-Object {
    $rtn = Test-Connection -CN $_.dnshostname -Count 1 -BufferSize 16 -Quiet
    IF($rtn -match 'True') {write-output $_.name | out-file C:\chd38computers_ping=true.csv -Append }
    ELSE { write-output $_.name | out-file C:\chd38computers_ping=false.txt -Append }
    $computers = Import-Csv "C:\chd38computers_ping=true.csv"
    foreach($obj in $computers){
    Get-WmiObject -Class win32reg_addremoveprograms | Select DisplayName,Publisher,Version,Installdate | Sort Publisher -Descending| Export-Csv d:\installed_apps.csv -append
    Thanks in advance for the help!
    adam

    To filter out duplicates, you can use the -unique switch for Select here:
    Get-WmiObject -Class win32reg_addremoveprograms | Select DisplayName,Publisher,Version,Installdate -unique | Sort Publisher -Descending| Export-Csv d:\installed_apps.csv -append
    To manipulate excel file from Powershell you will need to use New-Object -ComObject "Excel.Application". I'd add the result of each computer into an array and then use the ComObject to add the content to a new sheet. You can read more here:
    http://blogs.technet.com/b/heyscriptingguy/archive/2013/04/03/excel-spreadsheets.aspx
    tompa
    http://tompaps.blogspot.com

  • No output from domsample procedure

    Hello,
    After running initjvm.sql successfully I am having the following
    problem...
    Have successfully installed plxmlparser on 8i and execute the
    domsample procedure using the family.xml document.
    I get the msg 'procedure completed successfully' but am not
    getting any other output.
    Does anyone have any idea why this would be occurring?
    Any responses greatly appreciated.
    Thanks,
    Travis
    null

    Travis Mitchell (guest) wrote:
    : Hello,
    : After running initjvm.sql successfully I am having the
    following
    : problem...
    : Have successfully installed plxmlparser on 8i and execute the
    : domsample procedure using the family.xml document.
    : I get the msg 'procedure completed successfully' but am not
    : getting any other output.
    : Does anyone have any idea why this would be occurring?
    : Any responses greatly appreciated.
    : Thanks,
    : Travis
    Travis,
    Did you forget to set serveroutput on? Maybe you should try
    that.
    Thanks,
    Travis
    null

  • Formatting output from a select statement?

    Hi: a trivial question.
    When I run a select on four fields, it prints the first field in one line and the rest in the second line.
    TYPE
      PROTO CLASS_ID DSTPORT
    BUILT_INBOUND_UDP
         17    50007      53
    Is there a any variable I can configure so that all four fields are printed in the same line?
    TYPE               PROTO CLASS_ID DSTPORT
    BUILT_INBOUND_UDP 17    50007      53Thanks
    Ray

    SQL> SELECT a.owner from all_all_tables a WHERE rownum = 1;
    OWNER
    SYS
    SQL> column owner format a15;
    SQL> SELECT a.owner from all_all_tables a WHERE rownum = 1;
    OWNER
    SYS
    SQL> column owner format a5;
    SQL> SELECT a.owner from all_all_tables a WHERE rownum = 1;
    OWNER
    SYS
    SQL>

  • Formatting output from psbase.InvokeGet

    I can run the following script to get each user's name, FQDN's and RDS (Terminal Services) path.  If I pipe the script to an OutFile when I run it, I get a text file with these elements listed on separate lines.  If I break it into two scripts
    with one getting display name and RDS profile and the other getting FQDN and RDS profile, I can work through the 2 output files with Word and Excel to get a spreadsheet of all 3 elements, but I would much rather not have to go through the added hassle since
    we will be checking this somewhat frequently in the near future.
    What can I do to the script below to have it output all 3 elements of each userID in a table?  If not in a table, then a text file with the elements separated by semicolons (doesn't have to be semicolons, but it can't be commas since the FQDN is full
    of commas) and each user's info on a separate line so that I can easily bring it into Excel?
    The script is:
    $Users = ([ADSISearcher]"(&(objectCategory=person)(objectClass=user))").findall() | select path
     foreach ($user in $users) {
     $userSearch = [adsi]"$($user.path)"
     $userSearch.psbase.InvokeGet(“displayname”)
     $userSearch.psbase.InvokeGet(“distinguishedname”)
     $userSearch.psbase.InvokeGet(“terminalservicesprofilepath”)
    Thank you for your help with this.

    Hi Logan,
    Give this a try:
    $out = @()
    $Users = ([ADSISearcher]"(&(objectCategory=person)(objectClass=user))").findall() | select path
    foreach ($user in $users) {
    $userSearch = [adsi]"$($user.path)"
    try { $rdsPath = $userSearch.psbase.InvokeGet(“terminalservicesprofilepath”) }
    catch { $rdsPath = '' }
    $props = @{
    DisplayName = $userSearch.psbase.InvokeGet(“displayname”)
    DN = $userSearch.psbase.InvokeGet(“distinguishedname”)
    RDSPath = $rdsPath
    $out += New-Object PsObject -Property $props
    $out | Export-Csv .\userInfo.csv -NoTypeInformation
    Don't retire TechNet! -
    (Don't give up yet - 12,700+ strong and growing)

  • Pass records from one procedure to another

    hi,
    I have created following procedure. It takes input parameter and selects some records in EMP table based on condition.
    How to pass the output from this procedure to another procedure to manipulate the selected records further.
    Do I need to pass REF CURSOR or RECORD ?
    Thanks
    ===================================================
    create or replace procedure empdetails(pid IN number)
    is
    type ref_cur is REF CURSOR;
    rc ref_cur;
    type myrec is RECORD(id number, name varchar2(15), sal number);
    rec myrec;
    begin
    open rc for select id, name, sal from emp where deptid=pid;
    loop
    fetch rc into rec;
    exit when rc%notfound;
    dbms_output.put_line(rec.id||'--'||rec.name||'--'||rec.sal);
    end loop;
    close rc;
    end empdetails;

    don123 wrote:
    I have created following procedure. It takes input parameter and selects some records in EMP table based on condition.
    How to pass the output from this procedure to another procedure to manipulate the selected records further.
    Do I need to pass REF CURSOR or RECORD ?Record. The bulk collection approach is useful if you want to use the collection subsequently as a bind variable for bulk binding. But assuming you simply want to crunch data, the minimalistic approach would be:
    SQL> declare
      2          procedure ProcessEmp( e emp%RowType ) is
      3          begin
      4                  dbms_output.put_line( 'processing employee..'||e.ename );
      5          end;
      6  begin
      7          for e in(select * from emp order by 1) loop
      8                  ProcessEmp(e);
      9          end loop;
    10  end;
    11  /
    processing employee..SMITH
    processing employee..ALLEN
    processing employee..WARD
    processing employee..JONES
    processing employee..MARTIN
    processing employee..BLAKE
    processing employee..CLARK
    processing employee..SCOTT
    processing employee..KING
    processing employee..TURNER
    processing employee..ADAMS
    processing employee..JAMES
    processing employee..FORD
    processing employee..MILLER
    PL/SQL procedure successfully completed.
    SQL> An implicit bulk collect is done by the FOR loop, courtesy of the PL/SQL optimiser. As the procedure ProcessEmp() does not perform SQL processing itself (e.g. using employee data to fire off UPDATE, DELETE or INSERT SQL statements), a collection is not really needed as it would not contribute to the procedure's performance.
    If however nested SQL statements are fired from inside that cursor fetch loop, using a collection would enable these SQLs to make use of bulk binding.
    However, this approach ALWAYS need to be question, examined and validated - as a single SQL can often be used, combining the outer read/fetch loop (SELECT), with the nested SQLs (UPDATE/INSERT) done - using the MERGE or INSERT..SELECT statements for example.
    Explicit bulk processing should be an exception - as pushing data from the SQL engine to the PL/SQL engine, only to push that PL/SQL engine's data back to the SQL engine, is invariable a flawed, non performant, and non scalable approach.

  • Submitting xml publisher not producing output file when submiting from Oracle Procedure

    When Running XML publisher program from Oracle Procedure, Program not generating output file, but same XML publisher program running from Concurrent program runs and produces the output file.
    Here is the code
    CREATE OR REPLACE PROCEDURE apps.wmmgd_sepa_formats (
       p_return_msg      OUT      VARCHAR2,
       p_return_code     OUT      NUMBER,
       p_payment_batch   IN       VARCHAR2                                    ---,
    --- p_bank_name          in varchar2
    IS
       name:      wmmgd_sepa_formats
       purpose: this procedureis to  create SEPA payment formats
       revisions:
       ver      date        author           description
       1.0     6/11/2013  V Gongireddy  Created the Procedure
       l_ret         BOOLEAN;
       l_req_id      NUMBER;
       v_org_id      NUMBER;
       v_cntr        NUMBER;
       v_file_name   fnd_concurrent_requests.outfile_name%TYPE;
       v_language    VARCHAR2 (20);
    BEGIN
       SELECT fnd_profile.VALUE ('ORG_ID')
         INTO v_org_id
         FROM DUAL;
       fnd_file.put_line (fnd_file.LOG, 'org id ' || v_org_id);
       fnd_file.put_line (fnd_file.output, 'Start org id ' || v_org_id);
       FOR i IN 1 .. 10000
       LOOP
          v_cntr := v_cntr + 1;
       END LOOP;
       l_ret :=
          fnd_request.add_layout ('SQLAP',
                                  ' WMMGDSEPAFORMATXSL',
                                  'en',
                                  'US',
                                  'XML'
       IF l_ret = TRUE
       THEN
          BEGIN
             fnd_file.put_line (fnd_file.output,
                                'Payment batch ' || p_payment_batch
             l_req_id :=
                fnd_request.submit_request ('SQLAP',
                                            'WMMGDSEPAFORMAT',
                                            FALSE,
                                            p_payment_batch
             v_cntr := 0;
             FOR i IN 1 .. 10000
             LOOP
                v_cntr := v_cntr + 1;
             END LOOP;
             p_return_msg := 'Request submitted. ID = ' || l_req_id;
             p_return_code := 0;
             COMMIT;
          EXCEPTION
             WHEN OTHERS
             THEN
                p_return_msg :=
                      'Payment Request set submission failed - unknown error: '
                   || SQLERRM;
                p_return_code := 2;
                fnd_file.put_line (fnd_file.LOG,
                                   'the_request_id ' || l_req_id || p_return_msg
          END;
       END IF;
    END wmmgd_sepa_formats;
    Thanks in advance

    And metalink note 1100253.1 states that this issue (java.lang.StackOverflowError) might be caused by a too large set of data to be sorted in the layout file. Recommendation is to removed the sort from the layout file and instead sort the data already in the data definition.
    regards,
    David.

  • Need formatted EXCEL output, from View Output,Oracle Applications

    To view the report(Normal RDF report,not XML Publisher Report) output in EXCEL, I changed the Profile Options.
    From: System Administrator Responsibility.
    Navigation: Install -> Viewer Options.
    Added the below entry.
    PDF application/vnd.ms-excel Microsoft Excel
    Now when I submit the report, after completing, when clicked to View Output, I can see the list showing Browser and Microsoft Excel.
    I saved the Excel Sheet,but its not formatted. How do I get the formatted Output. As columns are not in proper shape.
    Please do the needful.
    Thanks.

    Hi Abdul;
    Please check below thread's mention metalink note&advice:
    Open Text output of a Report in Excel - Bad format
    Re: Open Text output of a Report in Excel  - Bad format
    Hope it helps
    Regard
    Helios

  • JDev generated webservices encodes XML output from PL/SQL procedure

    I have a PL/SQL packaged procedure which takes some input parameters and produces one output parameter. The output parameter is of type CLOB and after the procedure has run, it contains a big piece of XML data.
    Using JDeveloper 10.1.3.1, I've published this packaged procedure as a webservice. The generated webservice is fine and works, except for one tiny little issue: the XML that is taken from the output parameter is encoded.
    Here is an example of the SOAP message that the webservice returns:
    <?xml version="1.0" encoding="UTF-8"?>
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:ns0="http://gbv0300u/GBV0300U.wsdl/types/"><env:Body><ns0:gbv0300uResponse
    Element><ns0:result><ns0:obvglijstOut> & gt;type>GBV0001& gt ;/type& lt;
    & gt;diensten& lt;
    & gt;dienst>some value& gt;/dienst& lt;
    & gt;/diensten& lt;
    </ns0:obvglijstOut></ns0:result></ns0:gbv0300uResponseElement></env:Body></env:Envelope>
    (I've manually added an extra space between the & and lt; or gt; to make sure a browser will not translate it into a < or >!)
    The contents of the <ns0:obvglijstOut> element are filled with the output parameter from the PL/SQL package.
    How can I change the generated webservice, so the output from the PL/SQL package is used as is instead of being encoded?

    Update: I've tested a bit more by adding some output statements to the java code that JDeveloper generated. I'm now 100% sure the PL/SQL code gives the XML data correctly to the webservice.
    At this moment my guess is that somewhere in the WSDL definition there is something that enables the encoding of the data. But I'm not sure.
    Any help is greatly appreciated.

  • Capturing print command output from procedures

    Is it possible to capture the output from print statements in stored procedures such as the "print" command in Sybase stored procedures? This information doesn't seem to come through the result set.
    Thanks,
    KP

    This will be database specific. Please consult your database documentation.

  • Get server output from pl/sql stored procedure

    Hi Colleagues,
    I would like to get and watch the server output of my PL/SQL stored procedure
    when I run my java program and call it from. The Stored proc. uses "dbms_output.put_line".
    If it is clearly and possible (or not), will you send me your answer!
    Thanks a lot
    Ulve

    Hi,
    You can redirect the standard output to the console (i.e., the SQL output) using the
    DBMS_JAVA.SET_OUTPUT() method.
    SQL> SET SERVEROUTPUT ON
    SQL> call dbms_java.set_output (5000);But, the output is only printed when the stored procedure exits, and this setting works only for one call (i.e., the SQL call that immediately follows the invocation of DBMS_JAVA.SET_OUTPUT()). The minumum and default value is 2,000 characters and the maximum is 1,000,000 (1 million) characters. Notice the “SET SERVEROUTPUT ON” which enables displaying the outputs of stored procedures (Java or PL/SQL blocks) in SQL*Plus.
    Kuassi http://db360.blogspot.com

  • Transactional file output from a Java Stored Procedure invoked by trigger.

    I need to write information to a file from a Java Stored
    Procedure which is called from an insert trigger. This works OK
    except for the condition when a rollback is performed - the file
    is updated anyway.
    I need the Java Stored Procedure file output to be part of the
    transaction - performed on commit and skipped on rollback. Is
    there any way the Java Stored Procedure can be aware of the
    state of the transaction?

    i am Still facing the following problem:
    if i pass a parameter like :
    rm -f /test/menu.ksh
    then the required output is that the menu.ksh file gets deleted.
    but when i pass this command:
    ./test/menu.ksh
    It is supposed to execute the specified script but it does not.
    I have tried multiple things like giving chmod 777 rights to the following file and changing the command to /test/menu.ksh but nothing happens
    Can you kindly tell me what can the problem be. Is there any execution rights issue: i am executing these scripts from pl sql developer.
    You can find both the procedure and java method which is being called below
    ==========================================================================================
    create or replace procedure TEST_DISPLAY(filename in varchar2, result out varchar2, error out varchar2) is
    command varchar2(100);
    vRetChar varchar2(100);
    begin
    command := filename ;
    prc_host(command, vRetChar);
    result := vRetChar;
    dbms_output.put_line(result);
    Exception
    when No_Data_Found Then
    error := 'Command is not Found';
    dbms_output.put_line('Failure');
    return;
    end TEST_DISPLAY;
    ======================================================================
    create or replace and compile java source named host as
    import java.io.*;
    import java.lang.Runtime;
    import java.lang.Process;
    import java.io.IOException;
    import java.lang.InterruptedException;
    public class Host {
    public static void executeCommand(String command,String[] outString) {
    String RetVal;
    try {
    String[] finalCommand;
    final Process pr = Runtime.getRuntime().exec(command);
    // Capture output from STDERR...
    }

  • Design Question::Instantiating Object from Stored Procedure Output

    Hi All,
    I am confused with approaching this design issue. I called a Stored Procedure, and the output from the Stored Procedure is a REF CURSOR. The size of the REF CURSOR can be large.
    My Question is, is it a good idea to pass the values from the REF CURSOR to a class constructor, there by instantiating an object of that type. lets say
    //rset is of type ((OracleCallableStatement)callableStatement).getCursor(5);
    //rset is not ResultType
    while (rset.next()){
    new ClassXYZ(var1, var2, var3);
    /*var1, var2, var3 would be rset.getObject(1),rset.getObject(2),rset.getObject(3)
    Class XYZ does some business logic
    }Other things:
    1) Will the JVM hold up assuming good enough JVM mem size, while creating objects for the range 100 thousands?
    2) I do not know the cursor size. It can change randomly from business perspective. And, it would be in the range of 100 thousands
    I was thinking, If I can "police" the call to the Class XYZ in case of large data. May be I am totally off the best solution. Any light on the best way to approach will be great.
    Anyhow, this would be a standalone java application. Just in case if people are trying to suggest/recommend DAO etc.,
    Thank you,
    VJ

    You can use ConvertTo-Html:
    http://ss64.com/ps/convertto-html.html
    Here's an example:
    http://social.technet.microsoft.com/Forums/scriptcenter/en-US/5cb016d3-e2fb-43e7-9c01-10b6878056e4/formattable-lost-in-email
    Don't retire TechNet! -
    (Don't give up yet - 13,085+ strong and growing)

Maybe you are looking for

  • I can't delete an event in iCal

    I'm trying to delete an event from my iCal & a message pops up saying that only the calendar admin can make changes in the "Contacts birthdays & events". Since it's my calendar, aren't I the admin? This contact is no longer in my contacts book. Can a

  • Image logo not displayed in the signature in mail

    hi, I have a problem which is very very urgent to solve. I setup an account in the application namely mail in the mac system (imac) I am having. The signature I setup contains the text as well as a logo (image). When I send mails from that mac to oth

  • Accidentally partially deleted wrong iphoto library, iphoto won't recognised external HD copy

    Hello! I'm trying to free up some space on my MacBook OS X 10.5.8. with only 9.27GB free space left. I work a lot with images/graphics. As iphoto is the main space guzzler at 33.84GB, I was planning to move the iphoto library onto my external HD and

  • Restricting User from creating new records using when-validate-record

    Hi, I have a requirement for which I have to restrict he user from creating a record in the Supplier Master form if the suppliier type is 'Affiliate Supplier'. I have done the following setups Seq 10 Description Restricting user from creating Affilia

  • Iphone memory used up by "Events"

    My iPhone 4S started behaving strangely after upgrading to iOS 7. The memory fills up within an hour, and after this I have to reset it to free up again. In Settings:General:Usage it says that the additional memory is used in "Calendars & Reminders".