PL/SQL output in a region

Greetings,
I have the following pl/sql routine that I'm playing with, eventually wanting to create a custom report building the HTML myself based on another table. My problem is that this code will only work within a process. Is there any way to include it inside a region so that I an apply a template to the eventual output of the data?
declare
type my_cursor_type is ref cursor return emp%rowtype;
my_cursor my_cursor_type;
my_cursor2 my_cursor_type;
f emp%rowtype;
f2 emp%rowtype;
begin
open my_cursor for SELECT * from emp;
LOOP
fetch my_cursor into f;
exit when my_cursor%notfound;
htp.p(f.ename);htp.p('---');htp.p(f.empno); htp.br;
open my_cursor2 for select * from emp where empno = f.empno;
LOOP
fetch my_cursor2 into f2;
exit when my_cursor2%notfound;
htp.p(f2.empno); htp.br;
end LOOP;
close my_cursor2;
end LOOP;
close my_cursor;
end;
Thanks in Advance,
-- Cliff Moon
-- UTPA Webmaster

Looking for an answer to:
Report by Date with Date Headings.
? :) I'll take a stab at it tonight sometime.
Anyway, you can't do ref cursors in HTML DB. Additionally, there is no way to apply templates to anything but a SQL query or a function body returning SQL query.
Tyler

Similar Messages

  • Restricting the pl/sql error in report region(sql report)

    Hi,
    Is there any way to hiding pl/sql error in report region when we use generic column names*(Use Generic Column Names (parse query at runtime only)*
    ). and type is sql query else displaying alternative error message on that particular report region
    I am using apex 4.1 and 11g database
    Thanks
    Sagar.

    What kind of pl/sql error you are talking about?

  • SQL Query (updateable report) Region - Conditionally Hide and Set Values

    SQL Query (updateable report) Region - Conditionally Hide and Set Values
    Outline of requirement :-
    Master / Detail page with Detail updated on same page using SQL Query (updateable report).
    The detail region has the following source
    SELECT item_id,
           contract_id,
           CASE WHEN hardware_id IS NOT NULL THEN
                   'HA'
                WHEN backup_dev_id IS NOT NULL THEN
                   'BD'
                WHEN hardware_os_id IS NOT NULL THEN
                   'HS'
           END item_type,
           hardware_id,
           backup_dev_id,
           hardware_os_id
    FROM   "#OWNER#".support_items
    WHERE  contract_id = :P26_CONTRACT_IDThe table support_items implements arced relationships and has the following columns
    CREATE TABLE SUPPORT_ITEMS
      ITEM_ID         NUMBER                        NOT NULL,
      CONTRACT_ID     NUMBER                        NOT NULL,
      HARDWARE_ID     NUMBER,
      BACKUP_DEV_ID   NUMBER,
      HARDWARE_OS_ID  NUMBER
    )A check type constaint on support_items ensures that only one of the fk's is present.
          (    hardware_id    IS NOT NULL
           AND backup_dev_id  IS NULL
           AND hardware_os_id IS NULL
    OR    (    hardware_id    IS NULL
           AND backup_dev_id  IS NOT NULL
           AND hardware_os_id IS NULL
    OR    (    hardware_id    IS NULL
           AND backup_dev_id  IS NULL
           AND hardware_os_id IS NOT NULL
          )    Hardware_Id is a FK to Hardware_Assets
    Backup_dev_id is a FK to Backup_Devices
    Hardware_os_id is a FK to Hardware_op_systems
    The Tabular Form Element based on item_type column of SQL query is Displayed As Select List (based on LOV) referencing a named list of values which have the following properties
    Display Value     Return Value
    Hardware Asset    HA
    Backup Device     BD
    Computer System   HSThe Tabular Form Elements for the report attributes for hardware_id, backup_dev_id and hardware_os_id are all Displayed As Select List (Based on LOV).
    What I want to do is only display the Select List for the FK depending on the value of the Select List on Item Type, e.g.
    Item_Type is 'HA' then display Select List for hardware_id, do not display and set to NULL the Select Lists for backup_dev_id and hardware_os_id.
    Item_Type is 'BB' then display Select List for backup_dev_id, do not display and set to NULL the Select Lists for hardware_id and hardware_os_id.
    Item_Type is 'HS' then display Select List for hardware_os_id, do not display and set to NULL the Select Lists backup_dev_id and hardware_id.
    There are properties on elements to conditionally display it but how do we reference the values of the SQL query Updateable region? they are not given a page item name?
    Also on the Tabular For Elements there is an Edit tick against a report item - however when you go to the Column Attributes there is not a property with which you can control the Edit setting.
    What's the best way of implementing this requirement in APEX 3.1?
    Thanks.

    >
    Welcome to the forum: please read the FAQ and forum sticky threads (if you haven't done so already), and update your profile with a real handle instead of "user13515136".
    When you have a problem you'll get a faster, more effective response by including as much relevant information as possible upfront. This should include:
    <li>Full APEX version
    <li>Full DB/version/edition/host OS
    <li>Web server architecture (EPG, OHS or APEX listener/host OS)
    <li>Browser(s) and version(s) used
    <li>Theme
    <li>Template(s)
    <li>Region/item type(s) (making particular distinction as to whether a "report" is a standard report, an interactive report, or in fact an "updateable report" (i.e. a tabular form)
    With APEX we're also fortunate to have a great resource in apex.oracle.com where we can reproduce and share problems. Reproducing things there is the best way to troubleshoot most issues, especially those relating to layout and visual formatting. If you expect a detailed answer then it's appropriate for you to take on a significant part of the effort by getting as far as possible with an example of the problem on apex.oracle.com before asking for assistance with specific issues, which we can then see at first hand.
    I have a multi-row region that displays values and allows entries in a number of fields.Provide exact details of how this has been implemented. (An example on apex.oracle.com is always a good way to do this.)
    I should like the fields to be conditional in that they do not permit entry, but still display, if certain conditions apply (e.g. older rows greyed out). Can this be done? Almost anything can be done, often in multiple ways. Which are appropriate may be dependent on a particular implementation, the skills available to implement it, and the effort you're willing to expend on it. Hence it's necessary to provide full details of what you've done so far...

  • Where do I look at UTLTZUV2.SQL output?

    Dear gurus,
    I'm in the process of applying Security Patch 16: 6637237(CPUJAN2008) on my Windows 32bit envs. In this process, I need to check the existing TSTZ data using this oracle provided script. I ran it and didn't see the result. Here in the info I got:
    SQL> SET ECHO ON
    SQL> @c:\C:\oracle\product\10.2.0\db_1\RDBMS\ADMIN\utltzuv2.sql
    SP2-0310: unable to open file "c:\C:\oracle\product\10.2.0\db_1\RDBMS\ADMIN\utltzuv2.sql"
    SQL> @c:\C:\oracle\product\10.2.0\db_1\RDBMS\ADMIN\utltzuv2.sql
    SP2-0310: unable to open file "c:\C:\oracle\product\10.2.0\db_1\RDBMS\ADMIN\utltzuv2.sql"
    SQL> @c:\oracle\product\10.2.0\db_1\RDBMS\ADMIN\utltzuv2.sql
    SQL> Rem
    SQL> Rem $Header: utltzuv2.sql 21-dec-2006.02:22:10 huagli Exp $
    SQL> Rem
    SQL> Rem utltzuv2.sql
    SQL> Rem
    SQL> Rem Copyright (c) 2003, 2006, Oracle. All rights reserved.
    SQL> Rem
    SQL> Rem NAME
    SQL> Rem utltzuv2.sql - time zone file upgrade to a new version script
    SQL> Rem
    SQL> Rem DESCRIPTION
    SQL> Rem The contents of the files timezone.dat and timezlrg.dat
    SQL> Rem are usually updated to a new version to reflect the transition rule
    SQL> Rem changes for some time zone region names. The transition rule
    SQL> Rem changes of some time zones might affect the column data of
    SQL> Rem TIMESTAMP WITH TIME ZONE data type. For example, if users
    SQL> Rem enter TIMESTAMP '2003-02-17 09:00:00 America/Sao_Paulo',
    SQL> Rem we convert the data to UTC based on the transition rules in the
    SQL> Rem time zone file and store them on the disk. So '2003-02-17 11:00:00'
    SQL> Rem along with the time zone id for 'America/Sao_Paulo' is stored
    SQL> Rem because the offset for this particular time is '-02:00' . Now the
    SQL> Rem transition rules are modified and the offset for this particular
    SQL> Rem time is changed to '-03:00'. when users retrieve the data,
    SQL> Rem they will get '2003-02-17 08:00:00 America/Sao_Paulo'. There is
    SQL> Rem one hour difference compared to the original value.
    SQL> Rem
    SQL> Rem Refer to $ORACLE_HOME/oracore/zoneinfo/readme.txt for detailed
    SQL> Rem information about time zone file updates.
    SQL> Rem
    SQL> Rem This script should be run before you update your database's
    SQL> Rem time zone file to the latest version. This is a pre-update script.
    SQL> Rem
    SQL> Rem This script first determines the time zone version currently in use
    SQL> Rem before the upgrade. It then queries an external table to get all the
    SQL> Rem affected timezone regions between the current version (version before
    SQL> Rem the update) and the latest one. This external table points to the file
    SQL> Rem timezdif.csv, which contains all the affected time zone names in each
    SQL> Rem version. Please make sure that you have the latest version of the
    SQL> Rem timezdif.csv (the one corresponding to the latest timezone data file),
    SQL> Rem before you run the script.
    SQL> Rem
    SQL> Rem Then, this script scans the database to find out all columns
    SQL> Rem of TIMESTAMP WITH TIME ZONE data type. If the column is
    SQL> Rem in the regular table, the script also finds out how many
    SQL> Rem rows might be affected by checking whether the column data
    SQL> Rem contain the values for the affected time zone names.
    SQL> Rem If the column is in the nested table's storage table, we
    SQL> Rem don't scan the data to find out how many rows are affected but
    SQL> Rem we still report the table and column info.
    SQL> Rem
    SQL> Rem The result is stored in the table sys.sys_tzuv2_temptab.
    SQL> Rem Before running the script, make sure the table name doesn't
    SQL> Rem conflict with any existing table object. It it does,
    SQL> Rem change the table name sys.sys_tzuv2_temptab to some other name
    SQL> Rem in the script. You can query the table to view the result:
    SQL> Rem     select * from sys.sys_tzuv2_temptab;
    SQL> Rem
    SQL> Rem If your database has column data that will be affected by the
    SQL> Rem time zone file update, dump the data before you upgrade to the
    SQL> Rem new version. After the upgrade, you need update the data
    SQL> Rem to make sure the data is stored based on the new rules.
    SQL> Rem
    SQL> Rem For example, user scott has a table tztab:
    SQL> Rem create table tztab(x number primary key, y timestamp with time zone);
    SQL> Rem insert into tztab values(1, timestamp '');
    SQL> Rem
    SQL> Rem Before upgrade, you can create a table tztab_back, note
    SQL> Rem column y here is defined as VARCHAR2 to preserve the original
    SQL> Rem value.
    SQL> Rem create table tztab_back(x number primary key, y varchar2(256));
    SQL> Rem insert into tztab_back select x,
    SQL> Rem          to_char(y, 'YYYY-MM-DD HH24.MI.SSXFF TZR') from tztab;
    SQL> Rem
    SQL> Rem After upgrade, you need update the data in the table tztab using
    SQL> Rem the value in tztab_back.
    SQL> Rem update tztab t set t.y = (select to_timestamp_tz(t1.y,
    SQL> Rem     'YYYY-MM-DD HH24.MI.SSXFF TZR') from tztab_back t1 where t.x=t1.x);
    SQL> Rem
    SQL> Rem Or you can use export utility to export your data before the upgrade
    SQL> Rem and them import your data again after the upgrade.
    SQL> Rem
    SQL> Rem drop table sys.sys_tzuv2_temptab;
    SQL> Rem once you are done with the time zone file upgrade.
    SQL> Rem
    SQL> Rem NOTES
    SQL> Rem * This script needs to be run before upgrading to a new version time
    SQL> Rem     zone file. Also, before running this script, please make sure that
    SQL> Rem     you get the latest version of timezdif.csv file.
    SQL> Rem * This script must be run using SQL*PLUS.
    SQL> Rem * You must be connected AS SYSDBA to run this script.
    SQL> Rem * This script is created only for Oracle 10.1 or higer. A separate
    SQL> Rem     script is provided for Oracle 9i.
    SQL> Rem * Two files, tzuv2ext_*.log and tzuv2ext_*.bad will be created in
    SQL> Rem     the directory of $ORACLE_HOME/oracore/zoneinfo when using the
    SQL> Rem     external table for timezdif.csv file to get the affected time zones.
    SQL> Rem     After running the script, please refer to these two files to see if
    SQL> Rem     there are any rows in timezdif.csv, which are not loaded. If so,
    SQL> Rem     it might affect the correct selection of affected tables in the database.
    SQL> Rem     You can always delete tzuv2ext_*.log and tzuv2ext_*.bad.
    SQL> Rem * A Java stored procedure is created to get the system file separator,
    SQL> Rem     e.g., Windows uses '\' and Unix uses '/'. Before you run this script,
    SQL> Rem     make sure that the Java source/class object does not conflict with
    SQL> Rem     any existing Java source/class object in the database. If it does, please
    SQL> Rem     change the Java source/class object name GetFileSeparator to some other
    SQL> Rem     name in the script. Also make sure that the Java stored procedure does not
    SQL> Rem     conflict with any existing function in the database. If it does, please
    SQL> Rem     change the function name GET_FILE_SEPARATOR to some other name in the script.
    SQL> Rem     If renaming is needed, please make sure that you change all the occurences
    SQL> Rem     to make them consistent.
    SQL> Rem
    SQL> Rem
    SQL> Rem MODIFIED (MM/DD/YY)
    SQL> Rem huagli     12/21/06 - Backport huagli_bug-5126270 from main
    SQL> Rem               time zone update
    SQL> Rem srsubram     05/12/05 - 4331865:Modify script to work with prior
    SQL> Rem               releases
    SQL> Rem lkumar     05/11/04 - Fix lrg 1691434.
    SQL> Rem rchennoj     12/02/03 - Fix query
    SQL> Rem qyu      11/22/03 - qyu_bug-3236585
    SQL> Rem qyu      11/17/03 - Created
    SQL> Rem
    SQL>
    SQL> SET SERVEROUTPUT ON
    SQL>
    SQL> Rem=========================================================================
    SQL> Rem Check any existing table with this name sys.sys_tzuv2_temptab
    SQL> Rem=========================================================================
    SQL> DROP TABLE sys.sys_tzuv2_temptab
    2 /
    DROP TABLE sys.sys_tzuv2_temptab
    ERROR at line 1:
    ORA-00942: table or view does not exist
    SQL> CREATE TABLE sys.sys_tzuv2_temptab
    2 (
    3 table_owner VARCHAR2(30),
    4 table_name VARCHAR2(30),
    5 column_name VARCHAR2(30),
    6 rowcount     NUMBER,
    7 nested_tab VARCHAR2(3)
    8 )
    9 /
    Table created.
    SQL>
    SQL> Rem========================================================================
    SQL> Rem Check any existing table with this name sys.sys_tzuv2_temptab1
    SQL> Rem========================================================================
    SQL> DROP TABLE sys.sys_tzuv2_temptab1
    2 /
    DROP TABLE sys.sys_tzuv2_temptab1
    ERROR at line 1:
    ORA-00942: table or view does not exist
    SQL> CREATE TABLE sys.sys_tzuv2_temptab1
    2 (
    3 time_zone_name VARCHAR2(60)
    4 )
    5 /
    Table created.
    SQL>
    SQL> DECLARE
    2
    3 dbv     VARCHAR2(10);
    4 dbtzv     VARCHAR2(5);
    5 numrows     NUMBER;
    6 TYPE cursor_t IS REF CURSOR;
    7 cursor_tstz cursor_t;
    8 tstz_owner VARCHAR2(30);
    9 tstz_tname VARCHAR2(30);
    10 tstz_qcname VARCHAR2(4000);
    11 tz_version NUMBER;
    12 oracle_home VARCHAR(4000);
    13 tz_count INTEGER;
    14 plsql_block VARCHAR2(200);
    15 file_separator VARCHAR2(3);
    16
    17 BEGIN
    18
    19 --========================================================================
    20 -- Make sure that only version 10 or higher uses this script
    21 --========================================================================
    22
    23 SELECT substr(version,1,6) INTO dbv FROM v$instance;
    24
    25 IF dbv = '8.1.7.'
    26 THEN
    27      DBMS_OUTPUT.PUT_LINE('TIMEZONE data type was not supported in ' ||
    28                'Release 8.1.7.');
    29      DBMS_OUTPUT.PUT_LINE('No need to validate TIMEZONE data.');
    30      RETURN;
    31 END IF;
    32
    33 IF dbv in ('9.0.1.','9.2.0.')
    34 THEN
    35      DBMS_OUTPUT.PUT_LINE('Please contact Oracle support to get the script ' ||
    36                'for Release 9.0.1 or 9.2.0.');
    37      RETURN;
    38 END IF;
    39
    40 --========================================================================
    41 -- Get $ORACLE_HOME
    42 --========================================================================
    43
    44 plsql_block := 'BEGIN SYS.DBMS_SYSTEM.GET_ENV(:1, :2); END;';
    45 EXECUTE IMMEDIATE plsql_block USING 'ORACLE_HOME', OUT oracle_home;
    46
    47 --========================================================================
    48 -- Use an external table created on timezdif.csv file to get the
    49 -- affected time zones. In this way, every time when time zone information
    50 -- changes, we only need to provide user with the updated timezdif.csv file
    51 -- without changing utltzuv2.sql.
    52 --
    53 -- 1. Setup the directory for timezdif.csv and log files(log, bad log)
    54 -- 2. Check any existing external table with this name
    55 -- sys.sys_tzuv2_affected_regions
    56 -- 3. Setup the parameters of the external table
    57 --========================================================================
    58
    59 --========================================================================
    60 -- Create a Java stored procedure to get the file separator
    61 --========================================================================
    62
    63 EXECUTE IMMEDIATE 'CREATE OR REPLACE AND COMPILE JAVA SOURCE
    64                NAMED "GetFileSeparator" AS
    65                public class GetFileSeparator {
    66                     public static String get() {
    67                     return System.getProperty("file.separator");
    68                     }
    69                }';
    70
    71 EXECUTE IMMEDIATE 'CREATE OR REPLACE FUNCTION GET_FILE_SEPARATOR
    72                RETURN VARCHAR2
    73                AS LANGUAGE JAVA
    74                NAME ''GetFileSeparator.get() return java.lang.String'';';
    75
    76
    77 plsql_block := 'BEGIN :1 := GET_FILE_SEPARATOR(); END;';
    78 EXECUTE IMMEDIATE plsql_block USING OUT file_separator;
    79
    80 EXECUTE IMMEDIATE 'CREATE OR REPLACE DIRECTORY timezdif_dir AS ''' ||
    81                oracle_home || file_separator || 'oracore' ||
    82                          file_separator || 'zoneinfo''';
    83
    84
    85 EXECUTE IMMEDIATE
    86      'SELECT count(*)
    87      FROM all_tables
    88      WHERE owner = ''SYS'' and table_name = ''SYS_TZUV2_AFFECTED_REGIONS'''
    89 INTO tz_count;
    90
    91 IF tz_count <> 0
    92 THEN
    93      EXECUTE IMMEDIATE 'DROP TABLE sys.sys_tzuv2_affected_regions';
    94 END IF;
    95
    96
    97 EXECUTE IMMEDIATE 'CREATE TABLE sys.sys_tzuv2_affected_regions
    98                (
    99                version     NUMBER,
    100                time_zone_name VARCHAR2(40),
    101                from_year     NUMBER,
    102                to_year     NUMBER
    103                )
    104                ORGANIZATION EXTERNAL
    105                (
    106                TYPE ORACLE_LOADER
    107                DEFAULT DIRECTORY timezdif_dir
    108                ACCESS PARAMETERS
    109                (
    110                records delimited by newline
    111                badfile timezdif_dir:''tzuvext%a_%p.bad''
    112                logfile timezdif_dir:''tzuvext%a_%p.log''
    113                fields terminated by '',''
    114                lrtrim
    115                missing field values are null
    116                (
    117                     version, time_zone_name, from_year, to_year
    118                )
    119                )
    120                LOCATION (''timezdif.csv'')
    121                )
    122                REJECT LIMIT UNLIMITED';
    123
    124 --======================================================================
    125 -- Check if the TIMEZONE data is consistent with the latest version.
    126 --======================================================================
    127
    128 EXECUTE IMMEDIATE 'SELECT version FROM v$timezone_file' INTO tz_version;
    129 EXECUTE IMMEDIATE 'SELECT MAX(version) FROM sys_tzuv2_affected_regions' INTO dbtzv;
    130
    131 IF tz_version = dbtzv
    132 THEN
    133      DBMS_OUTPUT.PUT_LINE('TIMEZONE data is consistent with the latest version ' ||
    134                dbtzv || ' transition rules');
    135      DBMS_OUTPUT.PUT_LINE('No need to validate TIMEZONE data');
    136      RETURN;
    137 END IF;
    138
    139 --======================================================================
    140 -- Get tables with columns defined as type TIMESTAMP WITH TIME ZONE.
    141 --======================================================================
    142
    143 OPEN cursor_tstz FOR
    144      'SELECT atc.owner, atc.table_name, atc.qualified_col_name ' ||
    145      'FROM "ALL_TAB_COLS" atc, "ALL_TABLES" at ' ||
    146      'WHERE data_type LIKE ''TIMESTAMP%WITH TIME ZONE''' ||
    147      ' AND atc.owner = at.owner AND atc.table_name = at.table_name ' ||
    148      'ORDER BY atc.owner, atc.table_name, atc.column_name';
    149
    150 --======================================================================
    151 -- Query the external table to get all the affected time zones based
    152 -- on the current database time zone version, and then put them into
    153 -- a temporary table, sys_tzuv2_temptab1.
    154 --======================================================================
    155
    156 EXECUTE IMMEDIATE
    157      'INSERT INTO sys.sys_tzuv2_temptab1
    158      SELECT DISTINCT time_zone_name
    159      FROM sys.sys_tzuv2_affected_regions t
    160      WHERE t.version > ' || tz_version;
    161
    162 EXECUTE IMMEDIATE 'ANALYZE TABLE sys.sys_tzuv2_temptab1 ' ||
    163                'COMPUTE STATISTICS';
    164
    165 --======================================================================
    166 -- Check regular table columns.
    167 --======================================================================
    168 LOOP
    169      BEGIN
    170      FETCH cursor_tstz INTO tstz_owner, tstz_tname, tstz_qcname;
    171      EXIT WHEN cursor_tstz%NOTFOUND;
    172
    173      EXECUTE IMMEDIATE
    174           'SELECT COUNT(1) FROM ' ||
    175           tstz_owner || '."' || tstz_tname || '" t_alias, ' ||
    176           ' sys.sys_tzuv2_temptab1 r ' ||
    177           ' WHERE UPPER(r.time_zone_name) = ' ||
    178           ' UPPER(TO_CHAR(t_alias.' || tstz_qcname || ', ''TZR'')) ' INTO numrows;
    179
    180      IF numrows > 0 THEN
    181           EXECUTE IMMEDIATE ' INSERT INTO sys.sys_tzuv2_temptab VALUES (''' ||
    182           tstz_owner || ''',''' || tstz_tname || ''',''' ||
    183           tstz_qcname || ''',' || numrows || ', ''NO'')';
    184      END IF;
    185
    186      EXCEPTION
    187      WHEN OTHERS THEN
    188           DBMS_OUTPUT.PUT_LINE('OWNER : ' || tstz_owner);
    189           DBMS_OUTPUT.PUT_LINE('TABLE : ' || tstz_tname);
    190           DBMS_OUTPUT.PUT_LINE('COLUMN : ' || tstz_qcname);
    191           DBMS_OUTPUT.PUT_LINE(SQLERRM);
    192      END;
    193 END LOOP;
    194
    195 --======================================================================
    196 -- Check nested table columns.
    197 --======================================================================
    198
    199 EXECUTE IMMEDIATE
    200      'INSERT INTO sys.sys_tzuv2_temptab
    201      SELECT owner, table_name, qualified_col_name, NULL, ''YES''
    202      FROM ALL_NESTED_TABLE_COLS
    203      WHERE data_type like ''TIMESTAMP%WITH TIME ZONE''';
    204
    205
    206 DBMS_OUTPUT.PUT_LINE('Query sys.sys_tzuv2_temptab table to see ' ||
    207                'if any TIMEZONE data is affected by version ' || dbtzv ||
    208                ' transition rules');
    209
    210 EXCEPTION
    211 WHEN OTHERS THEN
    212      IF INSTR(SQLERRM, 'KUP-04063') != 0
    213      THEN
    214      DBMS_OUTPUT.PUT_LINE('Directory for file timezdif.csv is not correctly specified!');
    215      DBMS_OUTPUT.PUT_LINE(sqlerrm);
    216      ELSIF INSTR(SQLERRM, 'KUP-04040') != 0
    217      THEN
    218      DBMS_OUTPUT.PUT_LINE('File timezdif.csv in TIMEZDIF_DIR not found!');
    219      ELSE
    220      DBMS_OUTPUT.PUT_LINE(SQLERRM);
    221      END IF;
    222
    223 END;
    224 /
    ORA-25153: Temporary Tablespace is Empty
    PL/SQL procedure successfully completed.
    SQL>
    SQL> COMMIT
    2 /
    Commit complete.
    SQL>
    SQL> DECLARE
    2 tz_count NUMBER;
    3
    4 BEGIN
    5
    6 --========================================================================
    7 -- After obtaining the file separator, drop the Java stored procedure
    8 --========================================================================
    9
    10 EXECUTE IMMEDIATE
    11      'SELECT count(*)
    12      FROM user_objects
    13      WHERE object_name = ''GetFileSeparator'' and UPPER(object_type) like ''JAVA%'''
    14 INTO tz_count;
    15
    16 IF tz_count > 0
    17 THEN
    18      EXECUTE IMMEDIATE 'DROP JAVA SOURCE "GetFileSeparator"';
    19 END IF;
    20
    21 EXECUTE IMMEDIATE
    22      'SELECT count(*)
    23      FROM user_objects
    24      WHERE object_name = ''GET_FILE_SEPARATOR'' and UPPER(object_type) = ''FUNCTION'''
    25 INTO tz_count;
    26
    27 IF tz_count > 0
    28 THEN
    29      EXECUTE IMMEDIATE 'DROP FUNCTION GET_FILE_SEPARATOR';
    30 END IF;
    31
    32 END;
    33 /
    PL/SQL procedure successfully completed.
    SQL>
    SQL> COMMIT
    2 /
    Commit complete.
    SQL>
    SQL> Rem=========================================================================
    SQL> SET SERVEROUTPUT OFF
    SQL> Rem=========================================================================
    SQL> spool off
    Could you help me find the TSTZ data if there are any? Thank you in advance.

    Ok, I found out that I need to apply the patch 5746875 to have that. But there only instruction to apply this patch on unix env. I need on Windows. Can any body help me?

  • SPOOLING SQL output using Shell script

    Hi all,
    Is that Possible to Customize the SQL output in EXCEL using SET commandsby spooling
    Desired Output in Excel sheet:
    Counts           Original Query
    236487 Select *..............
    Can anyone plzz help me...Thanks

    Krux_rap wrote:
    Hi all,
    Is that Possible to Customize the SQL output in EXCEL using SET commandsby spooling
    Desired Output in Excel sheet:
    Counts           Original Query
    236487 Select *..............
    Can anyone plzz help me...Thanks
    SQL and PL/SQL FAQ
    What problem are you really trying to solve?

  • Cannot get literal amerpsand to display in SQL output

    Gurus,
    Thanks so much for your help, in advance.
    I'm outputting a literal string value to an output file, however, Linux isn't playing by SQL's rules. The ampersand character which I'm trying to disply as a knowledge base link is screwing up the output. Typically, the "&&" is the escape for displaying "&" in SQL output, however, this doesn't work inside a shell script.
    Does anyone know the escape characters to disply the ampersand properly for the following?
    I've include double ampersand, as per SQL's rules...
    col Instructions3 heading "KNOWLEDGE BASE SUPPORT LINK" format a4000
    select 'http://vr05a2.us.com:86/viewtopic.php?f=141&&t=2057&&p=2334&&hilit=over+pick&&sid=56b38c52bf3b36f1d17b854b29a41a3b#p2334' Instructions3
    from dual;
    Thanks,
    Scott
    Edited by: sreese on Jul 11, 2012 9:39 AM
    Edited by: sreese on Jul 11, 2012 9:43 AM

    The usual escape character is the backslash (\), but depending on your shell script it may be a matter of quoting the output.
    For instance:
    <pre>
    echo "$0&&"
    -bash&&
    echo '$0&&'
    $0&&
    echo \"
    echo "'"
    echo \&\&
    <pre>

  • Display PL/SQL funtion output in HTML Region dynamically

    I have a form/report with just 2 items (one is hidden). When I click on the displayed field, I would like the output of a function/procedure (with the form/report field as argument) to display in a region on the same form. I already have a function with varchar2 as return value and also a procedure that prints out html output through htp.p package.
    But couldn't figure out how to connect the form and the region and be in sync.
    I have a chemical structure data stored as CLOB in the DB with an ID. Basically, clicking on the ID should pass the CLOB to the procedure that outputs the <embed and so on tags for a plugin to display my chemical structure.
    Any help/guidance is appreciated.

    Hi Carl,
    Thanks for the post. I tried the static value and it works (structure displays). My problem is for it to pickup on the value of my field.
    I could give you my login credentials on htmldb but I am not sure if that would help as you would need the plugin installed on your browser (frre version may be available at www.mdl.com and search for "chime").
    I have something along these lines in procedure.
    htp.p('Hello World, I am ' || :APP_USER);
    htp.p('<table border=1 cellpadding=1 cellspacing=0 width=550><tr><td align=middle valign=top><font face=arial size=2>');
    htp.p('<input type=hidden name="queryrxn" value = "'|| :MOLCHIME ||'">');
    htp.p('<embed type=chemical/x-mdl-molfile width=300 height=100 queryformbox="document.query.queryrxn" structure='''||:MOLCHIME||'''></td></font>');
    htp.p('</tr></table>');
    Thanks for any input.
    Sridhar

  • HTML table containing SQL output in cells

    Hello,
    This might be a built-in function, but I haven't figured out how to do this: I want to display an HTML table (2x3 table) and in each cell, I want to display the output from different SQL statements. Some of the SQL statements return multiple rows, some just one. The cell data comes from unjoined tables, that is there is no join condition between each one of the cell SQL statements, it's a bit random.

    After much head-banging, I have worked this out and it came down to just changing 2 style definitions in the page template. I'm not really a Web developer so that wasn't obvious to me (or easy, I've read quite a bit on Google about stylesheets while working this).
    Basically I wanted to display a 3x3 "grid", similar to a table, but the data coming out from the 3x3 regions (all SQL query regions) returned different numbers of rows, which meant my page "rows" didn't align horizontally, they were just rendered wherever the last region stopped (vertically they were rendered properly because I put the regions in Colums 1, 2 and 3, standard page functionality).
    Eventually I started looking at the HTML page source and noticed the regions were using style defintions coming from my theme (standard APEX theme #12). I made a copy of the page template this page was using, and modified the header block of the new page template to "rewrite" the driving styles
    <title>#TITLE#</title>
    <link rel="stylesheet" href="#IMAGE_PREFIX#themes/theme_12/theme_V3.css" type="text/css" />
    <style type="text/css">
    a.plain { font-family:arial; text-decoration:none}
    td.t12Header {height=12px;font: italic small-caps 900 12px arial}
    td.t12Body {background-image: url(#APP_IMAGES#lock.png);background-repeat: no-repeat;background-position: left top;vertical-align= middle;height= 250px}
    </style>
    ...So I re-wrote the td (or table TD style) for t12Header and t12Body, by adding my own style definitions into the header after the call to the main css sheet. I also played around with putting a background image into each cell, I'll probably remove that but it was fun to explore.
    This rendered my individual table cells (via td.t12Body) @ 250px (which as I've found out is otherwise not supported, there's no built-in TABLE spec for "height") -- exactly what I wanted, now all the regions render vertically and horizontally.
    I did not test this with any browser other than IE7.
    If you know an easier way to do this, please do post a follow-up.

  • How can I use One Plugin with all his outputs on the region

    Hi All
    In Cubase I have a PlugIn Manager and when I have a Plugin like Omnisphere with 8 outputs I can route each output on one sequencer region.
    Can I do This as same in Logic?
    Exemple
    I will open a new Midi Instrument on a region. Than I Know I have 8 outputs and than I will have 8 Lines and each line I will create Midi comandos for each output separatly.
    can I do this? Or any Idee how can I do this?
    Thanks for help
    Marco

    When you load a plug-in that's capable of multi-output, you do have a menu choice about that when you load it, yeah ?
    You can create the additional channels that you need in the mixer - press the '+' button on the channel strip and it does it for you.

  • Restrict SQL output by User

    In the sample sql below, I figured out how to be able to restrict output to terms that end with a 5 for a specific user and would like to know if there is a more compact way to write this or is this the best way. This sql will only list out terms that end with a 5 if the user = 'MYSELF', otherwise if a different user is logged in, then they would see all the terms within the range.
    with ODP as
    (select distinct user, case when user = 'MYSELF' then
                           substr(term,1,5)|| '5'
                 else term
          end as ODPTerm
    from status_table
    where substr(term,6,1) = '5'
    select distinct user, term, odpterm
    from status_table
    left outer join ODP
    on term = ODPTerm
    where (user = 'MYSELF' AND ODPTerm IS NOT NULL)
    OR (user !='MYSELF' AND term between '201220' and '201245') There are many issues with how security was set up and the actual query will be used in an Oracle Report that is run via a URL. We were told that ITS prefers we create a separate report and restrict on term rather than trying to identify by user, however, that method would require we maintain several reports since users are able to enter parameters at run time. We thought that since at this point there are only two users (Non Employees) who need the restriction, this would be better at our end for report maintenance. The other reason is that eventually, we will be converting this report to another reporting tool, which would have a different security arrangement, so wouldn't be a long term issue about maintaining the hard coded user exclusion in the SQL statement.

    Hi,
    Here's one way of doing it:
    SELECT DISTINCT
            user
    ,     term
    ,     term     AS odpterm
    WHERE     (    user          = 'MYSELF'
         AND  SUBSTR (term, -1)     = '5'
    OR     (    user          != 'MYSELF'
         AND  TERM          BETWEEN     '201220'
                             AND     '201245'
    ;If you'd care to post some sample data (CREATE TABLE and INSERT statements), then I could test this.
    If you're using Oracle Enterprise Edition, then you can create a row-level security policy, such that limitations like this automatically apply to any query done on the table. Look up Virtual Private Database (or VPD ) and the Oracle-supplied package dbms_rls for more.
    Edited by: Frank Kulash on Oct 26, 2011 6:47 PM

  • Is there a simple way to refresh a SQL Query (Updatable report) region

    I have a page in APex 4.1 that has many regions. I would like to be able to refresh a single region.
    Currently, I have the following
    Region (sql query updateable report).
    STATIC ID = LANDINGS
    in the region footer, I have:
    <script type="text/javascript">
    $s('P110_LANDINGS_REGION_ID','#REGION_STATIC_ID#');
    </script>
    P110_LANDINGS_REGION_ID is a hidden field.
    I use javascript to refresh....but it does not seem to be working. Previously, we had hard-coded the region id ( $a_report('1363338167540162011','1','100','100');) ...but that ID was somehow corrupted, which has lead me to the 'OMG...there must be an easier way!' lament.
    the javascript is:
    $a_report('P110_LANDINGS_REGION_ID','1','100','100');
    thanks!
    Karen
    ps. could I just directly reference the static id in my javascript...
    $a_report('LANDINGS','1','100','100');

    Karen,
    First off: please post code in &#123;code&#125;...&#123;code&#125; tags!
    function AddFavoriteSpecies()
    get = new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=favorite_species_collection',0);
    gReturn = get.get();
    rowCount = rowCount + parseInt(gReturn);
    pHMS_add = '&G_HMS_FLAG.';
    $a_report('1363338167540162011','1','100','100');
    //$a_report($x('P110_LANDINGS_ID').value,'1','15','15');the statement:
    $a_report('1363338167540162011','1','100','100'); works, but the statement $a_report($x('P110_LANDINGS_ID').value,'1','15','15'); does not.
    Can anyone help.
    I am assigning the page field P110_LANDINGS_ID in the footer of a region with a static id = LANDINGS.
    <script type="text/javascript">
    $s('P110_LANDINGS_ID','#REGION_STATIC_ID#');
    </script>
    Well, let's start by dumping $a_report. This is undocumented code, and it has long been replaced by triggering a refresh.
    Next, don't use $x(pNode).value to retrieve a value. Rather use $v(pNode) to do this.
    function AddFavoriteSpecies()
       get = new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=favorite_species_collection',0);
       gReturn = get.get();
       rowCount = rowCount + parseInt(gReturn);
       pHMS_add = '&G_HMS_FLAG.';
       //get the region id from the item
       //use it in a jQuery selector to get the region
       //trigger the refresh event on this object
       $("#" + $v('P110_LANDINGS_ID')).trigger('apexrefresh');
    }Now if you want to make sure that P110_LANDINGS_ID contains a value, add an alert with its value before you use it.
    alert('P110_LANDINGS_ID value: '+$v('P110_LANDINGS_ID'))

  • How to do pivoting on part of an SQL output row in 10g

    Hi,
    I'm using Oracle 10.1.0.5.0.
    I would like to know what the general decode is for pivoting in 10g. I need to display PAGE_DISPLAY_NAME, ITEM_DISPLAY_NAME, ITEM_TYPE_DISPLAY_NAME essentially once and then display ATTRIBUTE_DISPLAY_NAME and ITEM_ATTRIBUTE_VALUE as a separate column for each:
    So my query starts me with the following output.
    PAGE_DISPLAY_NAME        ITEM_DISPLAY_NAME            ITEM_TYPE_DISPLAY_NAME     ATTRIBUTE_DISPLAY_NAME                              ITEM_ATTRIBUTE_VALUE
    Content     Rpt-Yearly-EMC Transactions-2007     RIKR Content Record     Benefit                                                       0
    Content     Rpt-Yearly-EMC Transactions-2007     RIKR Content Record     Business Function: Accounting                               0
    Content     Rpt-Yearly-EMC Transactions-2007     RIKR Content Record     Business Function: Consulting Services                       0
    Content     Rpt-Yearly-EMC Transactions-2007     RIKR Content Record     Business Function: Customer Data Management              0
    Content     Rpt-Yearly-EMC Transactions-2007     RIKR Content Record     Business Function: Facilities                                0
    Content     Rpt-Yearly-EMC Transactions-2007     RIKR Content Record     Business Function: Finance                                0
    Content     Rpt-Yearly-EMC Transactions-2007     RIKR Content Record     Business Function: HR                                        0
    Content     Rpt-Yearly-EMC Transactions-2007     RIKR Content Record     Business Function: IT                                        0
    Content     Rpt-Yearly-EMC Transactions-2007     RIKR Content Record     Business Function: International                        0
    Content     Rpt-Yearly-EMC Transactions-2007     RIKR Content Record     Business Function: Inventory Control                     0
    Content     Rpt-Yearly-EMC Transactions-2007     RIKR Content Record     Business Function: Legal                                0
    Content     Rpt-Yearly-EMC Transactions-2007     RIKR Content Record     Business Function: Marketing                                0
    Content     Rpt-Yearly-EMC Transactions-2007     RIKR Content Record     Business Function: Sales                                1
    Content     Rpt-Yearly-EMC Transactions-2007     RIKR Content Record     Business Function: Sales Operations                     1I'd like to show the following:
    PAGE_DISPLAY_NAME        ITEM_DISPLAY_NAME            ITEM_TYPE_DISPLAY_NAME        decode(...),   decode(...), .....         decode(etc...
    Content     Rpt-Yearly-EMC Transactions-2007     RIKR Content Record          Benefit    Business Function: Accounting  
    Content     Rpt-Yearly-EMC Transactions-2007     RIKR Content Record             0                   0                              What's the general SQL for doing this type of thing?
    For the record, here's the initial SQL:
    select p.DISPLAY_NAME               PAGE_DISPLAY_NAME,
    i.DISPLAY_NAME                      ITEM_DISPLAY_NAME,
    it.DISPLAY_NAME                     ITEM_TYPE_DISPLAY_NAME,
    attr.DISPLAY_NAME                   ATTRIBUTE_DISPLAY_NAME,
    ia.VALUE                            ITEM_ATTRIBUTE_VALUE
    from
    wwsbr_item_attributes ia,
    wwsbr_attributes attr,
    wwsbr_all_items i,
    wwsbr_item_types it,
    wwsbr_all_folders p
    where
        ia.attribute_id = attr.id
    and ia.attribute_caid = attr.CAID
    and ia.item_masterid = i.id
    and ia.item_caid = i.caid
    and i.subtype = it.id
    and i.subtype_caid = it.caid
    and i.folder_id = p.id
    and i.active = 1
    and i.visible = 1
    and i.is_current_version = 1
    and upper(it.DISPLAY_NAME) like '%RIKR%'
    and substr(attr.DISPLAY_NAME,1,5) <> '-----' 
    order by i.DISPLAY_NAME, attr.DISPLAY_NAME;

    Hi,
    There are a few errors in the INSERT statements, but it looks like the ones that work provide a good enough sample.
    In your sample data,
    attribute_display_name = 'Benefit' only when item_type_display_name LIKE '%RIKR%', and
    attribute_display_name = 'Billing & Collections' only when item_type_display_name LIKE '%OMKR%'
    and so on, for the other values. In other words, just by looking at attribute_display_name , once could predict whether item_type_display_name was LIKE '%RIKR%' or '%OMKR%'.
    If that's alwsays the case, then you can say:
    SELECT    page_display_name
    ,       item_display_name
    ,       item_type_display_name
    ,       MAX (DECODE ( attribute_display_name
                          , 'Benefit'                         , item_attribute_value
                          , 'Billing & Collections'                    , item_attribute_value
               )          AS p1
    ,       MAX (DECODE ( attribute_display_name
                           , 'Business Function: Accounting'               , item_attribute_value
                    , 'Change Description'                    , item_attribute_value
               )           AS p2
    ,       MAX (DECODE ( attribute_display_name
                          , 'Business Function: Consulting Services'     , item_attribute_value
                    , 'Deal Type: Counrty Federal'                 , item_attribute_value
               )           AS p3
    ,       MAX (DECODE ( attribute_display_name
                    , 'Deal Type: Counrty International Order'     , item_attribute_value
               )           AS p4
    FROM       taxonomy
    GROUP BY  page_display_name
    ,       item_display_name
    ,       item_type_display_name
    ORDER BY  page_display_name
    ,       item_display_name
    ,       item_type_display_name
    ;This produces generically-named columns, 'p1', 'p2', ...:
                               ITEM_
    PAGE_      ITEM_           TYPE_
    DISPLAY_   DISPLAY_        DISPLAY_
    NAME       NAME            NAME                 P1  P2  P3  P4
    Archive    Rpt-AR          RIKR Content Record      1   0
    Content    Rpt-Booking     RIKR Content Record      1   0
    Documents  Calc-Discount   OMKR Document        0       0   0
    Documents  Calc-Early      OMKR Document        0       0   0I shortened item_display_name to make the output more readable.
    If you add a WHERE clause like
    WHERE   item_type_display_name LIKE '%RIKR%'then, of course, you would only get the first two rows of output from the result set above, but you would get all the same columns, including the p4 column that will necessarily be NULL.
    If my earlier assumption was wrong (for example, if attribute_display_name can 'Benefit' even when item_type_display_name is NOT LIKE '%RIKR%', but, when that happens, you want to ignore it), then change the pivot columns like this:
    ,       MAX ( CASE
                         WHEN  (     item_type_display_name LIKE '%RIKR%'
                           AND  attribute_display_name = 'Benefit'
                   OR        (     item_type_display_name LIKE '%OMKR%'
                           AND  attribute_display_name = 'Billing & Collections'
                   THEN  item_attribute_value
              END
               )          AS p1
    ,       MAX ( CASE
                         WHEN  (     item_type_display_name LIKE '%RIKR%'
                           AND  attribute_display_name = 'Business Function: Accounting'
                   OR        (     item_type_display_name LIKE '%OMKR%'
                           AND  attribute_display_name = 'Change Description'
                   THEN  item_attribute_value
              END
               )          AS p2
    ,       MAX ( CASE
                         WHEN  (     item_type_display_name LIKE '%RIKR%'
                           AND  attribute_display_name = 'Business Function: Consulting Services'
                   OR        (     item_type_display_name LIKE '%OMKR%'
                           AND  attribute_display_name = 'Deal Type: Counrty Federal'
                   THEN  item_attribute_value
              END
               )          AS p3
    ,       MAX ( CASE
                         WHEN  (     item_type_display_name LIKE '%OMKR%'
                           AND  attribute_display_name = 'Deal Type: Counrty International Order'
                   THEN  item_attribute_value
              END
               )          AS p4For the sample data given, this produces the same output as above.
    All this assumes that the conditions
    item_type_display_name LIKE '%RIKR%' and
    item_type_display_name LIKE '%OMKR%' are mutualyy exclusive; that is, you never have item_type_display like 'RIKR Content Record/OMKR Document'.
    If you do have values like that, then you'll need separate columns for each of the possible values of attribute_display_name. Given your sample data, that means 7 pivoted columns. Depending on your WHERE clause and your data, some of those columns might by NULL for all rows. As you suggested, you coul;d use the anlaytic ROW_NUMBER function to number the rows that actually occurred in the query. You would still have 7 pivoted columns, but the ones that were not always NULL would appear on the left, where they were easier to read.
    The number of columns, and their aliases, must be hard-coded into the query. If you want something that has column aliases like BENEFIT instead of P1, or only has 4 piovted columns when you only need 4, then you have to use dynamic SQL.
    You can fake column headings by doing a separate query, which includes some of the same conditions as the main query, figures out what the pivoted columns will be, and displays appropriate headings. I've done this when producing csv files, where the heading only had to appear once, at the very beginning. Getting such a heading to appear after, say, every 50 rows of output is much more complicated.
    You can fake the number of columns by using string aggregation to put all the pivoted data into one humongeous VARCHAR2 column, concatenating spaces so that it looks like 3, or 4, or however many columns.

  • Output to create Region 2 PAL DVD Problem

    I recently completed a 35 minute sequence, with my Audio/Video settings for sequence set as DV PAL 48 Khz. I exported a QT movie set at DV PAL 48 Khz. I then used this file with Roxio Toast set to PAL to burn a DVD. The burn was done on my G4 Powerbook, which is currently set to REGION 1. When the DVD was complete, it plays perfectly on a televison monitor connected to a REGION 2 DVD PLAYER. BUT, it seems that it won't play on a computer where the DVD drive is set to region 2. The error message is something like: "Unrecognizable DVD." Did I make an error in the FCP output? What might be the source of this problem? Any suggestions on how to use this FCP QT output to create a DVD that will play via a computer as well as a DVD player for region 2?

    Pamela:
    Something else. I cannot found in my Toast 7 settings any reference to "region" in DVD settings. I'm pretty sure that Toast (and even iDVD) creates region free video discs.
    Video standard (PAL or NTSC) has no relationship with region settings.
    DVDs from Europe are PAL and region 2 but those are independent settings when authoring the disc: PAL content doesn't mean "automatic" region 2.
    In pro authoring applications (like DVDSP) you can set the region to anything you want no matter the video standard (PAL or NTSC).
    EDIT
    Just to confirm that iDVD creates Region Free discs:
    http://discussions.apple.com/thread.jspa?messageID=2679283&#2679283
    Hope that helps !
      Alberto

  • Saving SQL+ output to a text file

    I have to use SQL+ on one of my databases. No way around it. So I will write my queries, run them, check the output, tweak them and run again as necessary. So I might start with
    SELECT
    ename,
    job
    FROM
    emp;Once I know it is working correctly, I wrap it in a procedure so I can get the data in a text file:
    SET TRIM ON
    SET PAGESIZE 2000
    SET SERVEROUTPUT ON SIZE unlimited
    EXEC DBMS_OUTPUT.ENABLE(null)
    SPOOL c:\mySQL\out.txt
    BEGIN
    DECLARE
    CURSOR c_cur IS
    SELECT
    ename,
    job
    FROM
    emp;
    BEGIN
    DBMS_OUTPUT.PUT_LINE(
    'NAME|JOB|'
    FOR r_cur IN c_cur LOOP
    DBMS_OUTPUT.PUT_LINE(
    r_cur.ename||'|'||
    r_cur.job
    END LOOP;
    END;
    END;
    /Then I import this into Excel as delimited data on the pipe |
    which works great until I decide that I actually do need one more column. Then I have make changes to the SQL, and two more changes in the output portion (one for the heading, and one for the LOOP)
    I was wondering if anyone had written a cool procedure that I could run ANY SQL through, and it would automatically know my column names write the headings and then loop through the data automatically.
    I'm not tied to using the exact procedure I described above. The key is, I am looking for a general procedure that I can run any script through, and it will handle the output for me, without additional modification.

    MrGibbage wrote:
    I have to use SQL+ on one of my databases. No way around it. So I will write my queries, run them, check the output, tweak them and run again as necessary. So I might start with
    SELECT
    ename,
    job
    FROM
    emp;Once I know it is working correctly, I wrap it in a procedure so I can get the data in a text file:
    SET TRIM ON
    SET PAGESIZE 2000
    SET SERVEROUTPUT ON SIZE unlimited
    EXEC DBMS_OUTPUT.ENABLE(null)
    SPOOL c:\mySQL\out.txt
    BEGIN
    DECLARE
    CURSOR c_cur IS
    SELECT
    ename,
    job
    FROM
    emp;
    BEGIN
    DBMS_OUTPUT.PUT_LINE(
    'NAME|JOB|'
    FOR r_cur IN c_cur LOOP
    DBMS_OUTPUT.PUT_LINE(
    r_cur.ename||'|'||
    r_cur.job
    END LOOP;
    END;
    END;
    /Then I import this into Excel as delimited data on the pipe |
    which works great until I decide that I actually do need one more column. Then I have make changes to the SQL, and two more changes in the output portion (one for the heading, and one for the LOOP)
    I was wondering if anyone had written a cool procedure that I could run ANY SQL through, and it would automatically know my column names write the headings and then loop through the data automatically.
    I'm not tied to using the exact procedure I described above. The key is, I am looking for a general procedure that I can run any script through, and it will handle the output for me, without additional modification.Why are you bothering with the PL/sql procedure at all? Why not just
    SET TRIM ON
    SET PAGESIZE 2000
    SPOOL c:\mySQL\out.txt
    SELECT
    ename,
    job
    FROM
    emp;
    spool off

  • Export all sql reports in a region to csv or pdf

    Hello there,
    I have a region on a particular page in apex and that region has about 12 different sql query reports.
    I have enabled csv option for each of them so there are 12 links to export each report. However
    I would like to have only 1 link which will save the contents of all the reports to csv or pdf. The
    column headings are different for some of these reports but wanted to know if something like this
    is possible.
    Thanks in advance for reading this.

    You might try wrapping the regions in html regions that essentially give you the ability to specify a valign=top for the report regions.
    So, your regions look like this:
    30 Report Start - contains region source = (div)<table width="100%" cellspacing="0" cellpadding="0"><tr><td valign="top">
    40 Approved Tests Report (Column 2) Conditional
    45 Report 2 Start - contains </td><td valign="top">
    60 Unapproved Tests Report (Column 2) Conditional
    65 Report 3 Start - contains </td><td valign="top">
    80 Approved Count by Build Report (Column 2) Conditional
    85 Report End - contains "</td></tr></table>(/div)"
    Replace () with the angle brackets
    Maybe there is a more elegant solution with templates or page level CSS or something..
    But that should work.
    Edited by: Bob37 on Sep 17, 2010 3:33 PM
    Edited by: Bob37 on Sep 17, 2010 3:33 PM

Maybe you are looking for