DB proc - do you need to create a table to pass a ref cursor record type?

I want to pass a limited selection of columns from a large table through a DB procedure using a REF CURSOR, returning a table rowtype:
CREATE OR REPLACE package XXVDF_XPOS_DS021_ITEMS AS
     TYPE XXVDF_XPOS_DS021_ITEM_ARRAY
     IS REF CURSOR
     return XXVDF_XPOS_DS021_ITEM_TABLE%ROWTYPE;
Do I need to create this dummy table?
I can't get a TYPE to work, where the type is an OBJECT with the desired columns in it.
So a dummy empty table will sit in the database...
Is there another way?
thanks!

You can use RECORD type declaration:
SQL> declare
  2   type rec_type is record (
  3    ename emp.ename%type,
  4    sal emp.sal%type
  5   );
  6   type rc is ref cursor return rec_type;
  7   rc1 rc;
  8   rec1 rec_type;
  9  begin
10   open rc1 for select ename, sal from emp;
11   loop
12    fetch rc1 into rec1;
13    exit when rc1%notfound;
14    dbms_output.put_line(rec1.ename || ' ' || rec1.sal);
15   end loop;
16   close rc1;
17  end;
18  /
SMITH 800
ALLEN 1600
WARD 1250
JONES 2975
MARTIN 1250
BLAKE 2850
CLARK 2450
SCOTT 3000
KING 5000
TURNER 1500
ADAMS 1100
JAMES 950
FORD 3000
MILLER 1300or use, for example, VIEW to declare rowtype:
SQL> create view dummy_view as select ename, sal from emp;
View created.
SQL> declare
  2   type rc is ref cursor return dummy_view%rowtype;
  3   rc1 rc;
  4   rec1 dummy_view%rowtype;
  5  begin
  6   open rc1 for select ename, sal from emp;
  7   loop
  8    fetch rc1 into rec1;
  9    exit when rc1%notfound;
10    dbms_output.put_line(rec1.ename || ' ' || rec1.sal);
11   end loop;
12   close rc1;
13  end;
14  /
SMITH 800
ALLEN 1600
WARD 1250
JONES 2975
MARTIN 1250
BLAKE 2850
CLARK 2450
SCOTT 3000
KING 5000
TURNER 1500
ADAMS 1100
JAMES 950
FORD 3000
MILLER 1300 Rgds.

Similar Messages

  • Need To Create a table in Sql Server and do some culculation into the table from Oracle and Sql

    Hello All,
    I'm moving a data from Oracle to Sql Server with ETL (80 tables with data) and i want to track the number of records that i moving on the daily basis , so i need to create a table in SQL Server, wilth 4 columns , Table name, OracleRowsCount, SqlRowCount,
    and Diff(OracleRowsCount - SqlRowCount) that will tell me the each table how many rows i have in Oracle, how many rows i have in SQL after ETL load, and different between them, something like that:
    Table Name  OracleRowsCount   SqlRowCount  Diff
    Customer                150                 150            
    0
    Sales                      2000                1998          
    2
    Devisions                 5                       5             
    0
    (I can add alot of SQL Tasks and variables per each table but it not seems logicly to do that, i tryid to find a way to deal with that in vb but i didn't find)
    What the simplest way to do it ?
    Thank you
    Best Regards
    Daniel

    Hi Daniel,
    According to your description, what you want is an indicator to show whether all the rows are inserted to the destination table. To achieve your goal, you can add a Row Count Transformation following the OLE DB Destination, and redirect bad rows to the Row
    Count Transformation. This way, we can get the count of the bad rows without redirecting these rows. Since the row count value is stored in a variable, we can create another string type variable to retrieve the row count value from the variable used by the
    Row Count Transformation, and then use a Send Mail Task to send the row count value in an email message body. You can also insert the row count value to the SQL Server table through Execute SQL Task. Then, you can check whether bad rows were generated in the
    package by querying this table.  
    Regards,
    Mike Yin
    TechNet Community Support

  • Need to create a table

    hi
    i need to create a table emp( eno, ename, salary, address, doj, dob(dd-mm-yyyy), phone, city)
    which datatype suits for the dob column. as we need to enter in the format as 'dd-mm-yyyy'.
    please help.

    Hi,
    1009262 wrote:
    hi
    i need to create a table emp( eno, ename, salary, address, doj, dob(dd-mm-yyyy), phone, city)
    which datatype suits for the dob column. as we need to enter in the format as 'dd-mm-yyyy'.The DATE datatype is best for anything that indicates a point in time. Which format you want has nothing to do with the data type; DATEs can be entered or displayed in virtually any format you wish. I've said it, and the 2 earlier replies said it, but this is important enough to repeat: Always use the DATE datatype for information about dates.
    The only exception is when fractions of a second are significant, or when you need to capture time zone information along with the date. In that case, use the TIMESTAMP data type, but DATEs are a lot easier to use, and there are many more useful built-in functions for manipulating DATEs, so use DATEs whenever possible. For date-of-birth, you probably don't want to record hours, minutes or seconds, let alone fractions of a second, so there's no reason to use a TIMESTAMP, and there is never any reason to use any other datatype, such as VARCHAR2 or NUMBER.

  • Urgent Need for creating 100 tables in Oracle.

    Hello All,
    I need to create 100 tables in oracle using a loop.
    Please suggest . Advance thanks for your efforts.
    ANto

    I am getting the foll error at run time when executing the procedure ..
    ERROR at line 1:
    ORA-01031: insufficient privileges
    ORA-06512: at "ORAUSER.CREATE_100_TABLE", line 9
    ORA-06512: at line 1
    The script goes here ...
    create or replace procedure create_100_table
    is
    v_sql_string varchar2(200);
    begin
    for i in 1..100
    loop
    v_sql_string := 'create table ajames' || i || ' as select * from emp';
    execute immediate v_sql_string;
    end loop;
    end;
    ------------------------

  • You need to create more buy in for this to work

    As opposed as I am to lifetime subscriptions (creative cloud, MS Office, virus scanners, etc.), I can see some value in them as long as they bring value to me.  I have no doubt in my mind that I can continue to work unhindered permanately with Adobe CS6 products without giving you another red cent - ever.  Just as I can continue to use MS Office 2010 withouit paying MS anything else for a word processor, spreadsheet program and email/calendar client.  You need to give me a REAL reason to not do this.  I can personally only justify $50/month for CC with the following features:
    1.  Real cross-platform support.  That means linux.  There is no point in me spending money forever on a product (a product for which I can already do everything now with no additional cost).  My business will gain nothing from CC short-term or long-term unless I can gain value from this purchase and save money from something else, and that basically means running on linux.  Putting an extremely stable five-year updateable workstation OS like Ubuntu 12.04 on current hardware without having to shell out big $$$ to Apple for their non-upgradeable and non-serviceable hardware would flat-out save me money, money I would be willing to give to Adobe instead of Apple.  I do have some workstations running Windows, but the Ubuntu and Mac workstations are more productive IMO working in creative suite, with less OS issues.  I can see no reason not to code/port to linux other than developer laziness.  People are disgusted with Microsoft since Windows 8 and Mac's just cost too much money in this economy.  There are only a few reasons everyone is not already running linux - games in Windows (which Valve is starting to address with the steambox and steam for linux), Adobe products and MS Office.  Office 2010 runs great under wine, so screw Microsoft.  If you developed CC for linux, big-name vendors would instantly start selling home and business workstations pre-installed with Ubuntu designed for digital editing.  It's not that linux users are completely opposed to spending money on software and demanding open-source, they just don't have much of a choice of anything to spend it on.  Give them a quality product at a reasonable price, they will pay.
    2.  Better mobile support.  We need real tools for quick edits on popular formats on our mobile devices.  As our devices are getting faster, we need more integration for when we are not sitting in front of our workstation.  For $50/month, this should be included and featured.
    3.  Better cloud-based training.  To draw people in and keep them paying, they are going to need more frequent content updates, that also means proper feature training.  The training should be easy to understand and readily available upon new features.
    4.  More cloud storage, much more.

    ebnovotny,
    Have you also used Address Book>Card>Make This My Card?
    If you have, you could also quit iCal, find the com.apple.ical.plist file in your Macintosh HD/Users/yourusername/Library/Preferences folder and drag it to the Desktop. Then log out/in or restart and check if your card is recognized.

  • Do you need to generate HTML table rows from XML in InDesign?

    General issue: you export XML and you get a bunch of content for xml elements that were a table in inDesign. But they don't have any rows, just cell after cell. What will make rows in your output?
    Solution: XSLT; you need to use the @aid:tcols attribute of exported XML to determine the number of columns that your table should be. This is written in XSLT 1.1 so it shoud work with an export from InDesign. If you have problems with using it on export of XML, try using it on the XML afetr it has been exported, in Oxygen or other XSLT processor. Best to save acopy of your files before using the XSLT with them.  Copy all of the plain text and past into a new file, save with your own filename, ending with .xsl file extension. Then when exporting XML from InDesign CS3-5, browse to your new .xsl file and select it. PLEASE read about XSLT files at w3c.schools or other resource if you want to understand what is going on with this file.
    BTW <!-- indicates comments in code -->
    <?xml version="1.0" encoding="UTF-8"?>
    <!-- NO WARRANTY that this example code will work as written for your XML file in InDesign. You can add more templates to the output to map your heading styles to h1, h2, etc. -->
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.1"
        xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/"
        xmlns:aid5="http://ns.adobe.com/AdobeInDesign/5.0/" exclude-result-prefixes="xsl aid aid5">
        <xsl:output method="html" indent="yes" encoding="UTF-8"
            doctype-public="http://www.w3.org/TR/xhtml/DTD/xhtml-transitional.dtd"/>
    <!-- parameter to use the name of element with attribute aid:theader as the th output -->
        <xsl:param name="tableElem">//*[local-name()][@aid:table='table']</xsl:param>
        <xsl:param name="colheadStyle">
            <xsl:value-of select="//*[local-name()][@aid:theader][1]"/>
            <!-- i.e. colHead-->
        </xsl:param>
    <!-- parameter to use the name of element with attribute aid:cell but not aid:theader as the td  output -->
    <!--i.e. tabletext or whatever the name of your Cell level  element is in InDesign -->
        <xsl:param name="cellStyle">
            <xsl:value-of select="//*[local-name()][@aid:table='cell' and not(@aid:theader)][1]"/>
        </xsl:param>
        <!-- handles a Story element marked up with HTML-type elements, but uses the <Table> element of IDD  -->
        <!-- if a true HTML table is in the content, it will be passed through -->
        <xsl:template match="Story"><!-- make a basic HTML file from a Story -->
            <html>
                <head>
                    <title>Sample Table</title>
                </head>
                <body>
                    <xsl:apply-templates><!-- will handle direct text of the  <Story>, and <Table> -->
                        <xsl:with-param name="colheadStyle" select="$colheadStyle"/>
                        <xsl:with-param name="cellStyle" select="$cellStyle"/>
                    </xsl:apply-templates>  
                </body>
            </html>
        </xsl:template>
       <!-- use the styles to find the elements of IDD <Table> element -->
        <xsl:template match="Table">
            <xsl:param name="colheadStyle">
                <xsl:value-of select="$colheadStyle"/>
            </xsl:param>
            <xsl:param name="cellStyle">
                <xsl:value-of select="$cellStyle"/>
            </xsl:param>
            <xsl:variable name="cellsPerRow">
                <xsl:value-of select="@aid:tcols"/>
            </xsl:variable>
            <table><!-- start the table -->
                <!-- xhtml requires lower-case name for table element-->
                <tr>
                    <xsl:apply-templates select="*[@aid:theader='']">
                        <xsl:with-param name="colheadStyle" select="$colheadStyle"/>
                        <xsl:with-param name="cellStyle" select="$cellStyle"/>
                    </xsl:apply-templates>
                </tr>
                <!--  and @aid:style=$cellStyle -->
                <xsl:for-each
                    select="*[@aid:table='cell'][not(@aid:theader='')][position() mod $cellsPerRow = 1]">
    <!-- some code adapted with  permission, from http://www.computorcompanion.com/LPMArticle.asp?ID=202
    Building HTML Tables with XSL by James Byrd; please include this acknowledgement in all files that use his code -->
    <!-- this is the tricky bit of the code that James Byrd set up
    p-class-tabletext-[position() mod $cellsPerRow = 1 continues looping until the position of the active element divided by $cellperRow (@aid:tcols value) tried with [@aid:style=$cellStyle] has a remainder of 1 -->
    <!--  .|following-sibling::p-class-tabletext-[position() &lt;  $cellsPerRow] applies first to the currently selects cell with "." then continues with the following-siblings whose position is less than  the value of cells per row (@aid:tcols value) -->
                    <tr>
                        <xsl:apply-templates
                            select=".|following-sibling::*[@aid:table='cell'][not(@aid:theader='')][position() &lt; $cellsPerRow]"
                        />
                    </tr>
                </xsl:for-each>
            </table>
        </xsl:template>
        <xsl:template match="*">
            <xsl:param name="colheadStyle">
                <xsl:value-of select="$colheadStyle"/>
            </xsl:param>
            <xsl:param name="cellStyle">
                <xsl:value-of select="$cellStyle"/>
            </xsl:param>
            <xsl:variable name="cellsPerRow">
                <xsl:value-of select="parent::Table/@aid:tcols"/>
            </xsl:variable>
            <xsl:choose>
                <!-- colHead aid:table="cell" aid:theader=""-->
                <xsl:when test="parent::Table and @aid:theader">
                    <th>
                        <xsl:apply-templates>
                            <xsl:with-param name="colheadStyle" select="$colheadStyle"/>
                            <xsl:with-param name="cellStyle" select="$cellStyle"/>
                        </xsl:apply-templates>
                    </th>
                    <xsl:if test="(position() = last()) and (position() &lt; $cellsPerRow)">
                        <xsl:call-template name="FillerCells">
                            <xsl:with-param name="cellCount" select="$cellsPerRow - position()"/>
                        </xsl:call-template>
                    </xsl:if>
                </xsl:when>
                <xsl:when test="parent::Table and @aid:table='cell' and not(@aid:theader)">
                    <td>
                        <xsl:apply-templates>
                            <xsl:with-param name="colheadStyle" select="$colheadStyle"/>
                            <xsl:with-param name="cellStyle" select="$cellStyle"/>
                        </xsl:apply-templates>
                    </td>
                    <xsl:if test="(position() = last()) and (position() &lt; $cellsPerRow)">
                        <xsl:call-template name="FillerCells">
                            <xsl:with-param name="cellCount" select="$cellsPerRow - position()"/>
                        </xsl:call-template>
                    </xsl:if>
                </xsl:when>
    <!-- for non-table elements this generic element handler will  pick up an aid:pstyle (if present) and create a class attribute from it. Works for any element that has the same name as HTML element such as <p> but it doesn't add wrapper elements like <ul> or <ol> for lists. -->
                <xsl:otherwise>
                    <xsl:element name="{name()}">
                        <xsl:if test="@aid:pstyle">
                            <xsl:attribute name="class">
                                <xsl:value-of select="@aid:ptyle"/>
                            </xsl:attribute>
                        </xsl:if>
                        <xsl:apply-templates>
                            <xsl:with-param name="colheadStyle" select="$colheadStyle"/>
                            <xsl:with-param name="cellStyle" select="$cellStyle"/>
                        </xsl:apply-templates>
                    </xsl:element>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:template>
        <!-- take care of text that is a direct child of the <Story> by wrapping it in a <p> to make valid HTML -->
        <xsl:template match="text()">
            <xsl:variable name="myString">
                <xsl:value-of select="string-length(normalize-space(.))"/>
            </xsl:variable>
            <xsl:choose>
                <xsl:when test="parent::Story">
                    <xsl:if test="$myString > 0">
                        <xsl:element name="p">
                            <xsl:attribute name="class">text</xsl:attribute>
                            <xsl:value-of select="normalize-space(.)"/>
                        </xsl:element>
                    </xsl:if>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:value-of select="normalize-space(.)"/>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:template>
       <!-- make br element conform to good HTML markup -->
        <xsl:template match="br">
            <br />
        </xsl:template>
        <!-- this recursive template calls itself until its test condition is satified -->
        <!-- it outputs a cell whose only content is a non-breaking space -->
        <!-- do not use   in place of Unicode &#160; for the non-breaking space -->
        <!-- the value of $cellCount is set in the main XSL template -->
        <xsl:template name="FillerCells">
            <xsl:param name="cellCount"/>
            <td>&#160;</td>
            <xsl:if test="$cellCount > 1">
                <xsl:call-template name="FillerCells">
                    <xsl:with-param name="cellCount" select="$cellCount - 1"/>
                </xsl:call-template>
            </xsl:if>
        </xsl:template>
    </xsl:stylesheet>
    Message was edited by: HoneoyeFalls
    Sample XML file exported from IDD
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <Story><Table xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/" xmlns:aid5="http://ns.adobe.com/AdobeInDesign/5.0/" aid:table="table" aid:trows="2" aid:tcols="2"><colHead aid:table="cell" aid:theader="" aid:crows="1" aid:ccols="1" aid:ccolwidth="44">1 colHead</colHead><colHead aid:table="cell" aid:theader="" aid:crows="1" aid:ccols="1" aid:ccolwidth="56">2 colHead</colHead><tabletext aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="44">1 tabletext</tabletext><tabletext aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="56">2 tabletext</tabletext><tabletext aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="44">row 2 1 tabletext</tabletext><tabletext aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="56">row 2 2 tabletext</tabletext></Table>
    <table><tr><th>normal HTML table heading</th></tr>
    <tr><td>normal HTML table<br/>cell text</td></tr></table></Story>

    You can use RECORD type declaration:
    SQL> declare
      2   type rec_type is record (
      3    ename emp.ename%type,
      4    sal emp.sal%type
      5   );
      6   type rc is ref cursor return rec_type;
      7   rc1 rc;
      8   rec1 rec_type;
      9  begin
    10   open rc1 for select ename, sal from emp;
    11   loop
    12    fetch rc1 into rec1;
    13    exit when rc1%notfound;
    14    dbms_output.put_line(rec1.ename || ' ' || rec1.sal);
    15   end loop;
    16   close rc1;
    17  end;
    18  /
    SMITH 800
    ALLEN 1600
    WARD 1250
    JONES 2975
    MARTIN 1250
    BLAKE 2850
    CLARK 2450
    SCOTT 3000
    KING 5000
    TURNER 1500
    ADAMS 1100
    JAMES 950
    FORD 3000
    MILLER 1300or use, for example, VIEW to declare rowtype:
    SQL> create view dummy_view as select ename, sal from emp;
    View created.
    SQL> declare
      2   type rc is ref cursor return dummy_view%rowtype;
      3   rc1 rc;
      4   rec1 dummy_view%rowtype;
      5  begin
      6   open rc1 for select ename, sal from emp;
      7   loop
      8    fetch rc1 into rec1;
      9    exit when rc1%notfound;
    10    dbms_output.put_line(rec1.ename || ' ' || rec1.sal);
    11   end loop;
    12   close rc1;
    13  end;
    14  /
    SMITH 800
    ALLEN 1600
    WARD 1250
    JONES 2975
    MARTIN 1250
    BLAKE 2850
    CLARK 2450
    SCOTT 3000
    KING 5000
    TURNER 1500
    ADAMS 1100
    JAMES 950
    FORD 3000
    MILLER 1300 Rgds.

  • Help Please:  Need To Create Temporary Table

    Hi Guys,
    I am a new Oracle user. I need to create this report that uses
    temporary table. I can't use "create" statment in the sql
    query. Now wihtout that I don't know how to create the
    temporary table. Please let me know if anyone has any
    suggestions.
    Thanks a billion
    Sam

    Hi Sam,
    yes, you can't apply neither Data Definition Language (DDL) nor
    Data Manipulation Language (DML), except SELECT statement, at
    the query builder inside your report. You may create a stored
    procedure containing the DDL or the DML, then run this stored
    procedure at the "Before Report" trigger. You can find this
    trigger under Report Triggers of your Object Navigator.
    hope this help you.
    have a nice day...
    daniel

  • When I try to send a calendar invite I get the following error ... iCal was unable to send the invitation.  To be able to send invitations, you need to create an address card for yourself in Address Book.

    I have deleted and recreated "My Card" several times, but iCal is still not recognizing the card.  The application was working fine until a few weeks ago.  I recently purchased Microsoft Office for Mac but have not installed any other new software.  Also checked to make sure my mac software is updated.  Help!!!

    ebnovotny,
    Have you also used Address Book>Card>Make This My Card?
    If you have, you could also quit iCal, find the com.apple.ical.plist file in your Macintosh HD/Users/yourusername/Library/Preferences folder and drag it to the Desktop. Then log out/in or restart and check if your card is recognized.

  • Help needed in creating a table that updates itself at runtime.

    I am working on creating a sniffer in java and need a GUI that will show the incoming packets as they are sniffed. How can I use tables such that they automatically update as and when the packets arrive.
    Any help on this matter would be appreciated thanks
    hasrar

    Hello, I am working in a Sniffer in java too, but I have not information about this.
    I want to tell you if you can send me some information or examples.

  • Need help creating Vector table for specific class

    I am trying to create a Vector table of class Node and I think I understand the concept but in practice I am not
    sure why the compiler complains about non-static reference on statement mv.table.add(new Node(names[n]). Please help. I can not get this thing to work.
    import java.util.*;
    class MyVector {
    Vtable table;
    public static void main(String[] args){
    MyVector mv = new MyVector();
    String names[] = {"one","two","three","four","five"};
    for (int n;n<names.length;n++)
    mv.table.add(new Node(names[n])); //<-ERROR
    table.list();
    if (table.del("de")) System.out.println("deleted");
    table.list();
    public MyVector(){
    System.out.println("MyVector_C");
    table = new Vtable();
    public class Node {
    private String name;
    public Node(){name=new String("Null");}
    public Node(String s){name=s;}
    public void setName(String s){name=s;}
    public String getName(){return name;}
    public String toString(){return "[Node:"+name+"]";}
    public class Vtable extends Vector {
    private Vector v;
    public Vtable(){v=new Vector();}
    public void add(Node n){v.add(n);}
    public Node getNode(String s){
    Iterator i=v.iterator();
    while(i.hasNext()){
    Node n;
    n = (Node)i.next();
    if (s.equals((String)n.name))
    return(n);
    return null;
    public void list(){
    Iterator i=v.iterator();
    while (i.hasNext()){System.out.println((Node)i.next());}
    public Boolean del(String s) {
    Iterator i=v.iterator();
    while(i.hasNext()){
    Node n = (Node)i.next();
    if (s.equals((String)n.name)) {
    v.remove(n);
    return(true);
    return(false);
    }

    public class Vtable extends Vector {
    private Vector v;
    public Vtable(){v=new Vector();}
    public void add(Node n){v.add(n);}
    public Node getNode(String s){
    Iterator i=v.iterator();
    while(i.hasNext()){
    Node n;
    n = (Node)i.next();
    if (s.equals((String)n.name))
    return(n);
    return null;
    I get ur problem...
    When VTable extends Vector all u have to do is...
    VTable table=new VTable();
    table.add(new node(..));
    There is no need to get the Vector obj in picture as VTable extends Vector...
    I guess, this helps u.

  • How to Create a Table Component Dynamically based on the Need

    Hello all,
    I have a problem i need to create dynamically tables based on the no of records in the database. How can i create the table object using java code.
    Please help.

    Winston's blog will probably be helpful:
    How to create a table component dynamically:
    http://blogs.sun.com/roller/page/winston?entry=creating_dynamic_table
    Adding components to a dynamically created table
    http://blogs.sun.com/roller/page/winston?entry=dynamic_button_table
    Lark
    Creator Team

  • Pl/Sql for creating Multiple record type file

    Hi all,
    I have a scenario where I need to create a flat file that contains two different record types in the same file. Basically, a way of getting both the header record and the corresponding detail records. Following are the details:
    Table A (Header Records)
    "REC_TYPE" "M_ID" "DATE" "*C_ID*"
    1 123 090807 *222*
    1 345 090907 *333*
    Table B (Detail Records)
    "REC_TYPE" "A_NO" "LINE_NO" "*C_ID*"
    2 7564 1 *222*
    2 4535 2 *222*
    2 4656 1 *333*
    2 6576 2 *333*
    In the output file, the resultset should be as:
    222, 123, 090807 (Header Record)
    *222, 7564, 1* (Detail Record)
    *222, 4535, 2* (Detail Record)
    333, 345, 090907 (Header Record)
    *333, 4656, 1 (Detail Record)*
    *333, 6576, 2 (Detail Record)*
    Any input is greatly appreciated.
    Thank you!

    NOT TESTED ! Don't remember when I used loops for the last time. I won't have database access until september (on vacation).
    declare
      type header_t is record
        c_id ... ,
      type detail_t is record
        c_id ... ,
      header_r header_t;
      detail_r detail_t;
      cursor c_h is select c_id, ...
                      from ...
                     order by 1;                      -- header cursor
      cursor c_d is select c_id, ...
                      from ...
                     order by 1;                      -- detail cursor
      end_line    varchar2(2) := chr(13) || chr(10);  -- chr(10) to be used for non Windows
      a_separator varchar2(1) := ',';
      a_buffer    varchar2(32767);
      l_buffer    constant number := 32767;
      f_handle    utl_file.file_type;
      procedure buffer_put(p_line in varchar2) is
      begin
        if length(a_buffer) + length(p_line) < l_buffer then
          a_buffer := a_buffer || p_line;
        else
          utl_file.put(f_handle,a_buffer);
          a_buffer := p_line;
        end if;
      end;
      function build_header_record(p_record in header_t) return varchar2 is
        retval varchar2(4000) := '';
      begin
        retval := retval || to_char(p_record.c_id) || a_separator;
        retval := retval || ... || a_separator;
        retval := retval || ... || end_line;
        return retval;
      end;
      function build_detail_record(p_record in detail_t) return varchar2 is
        retval varchar2(4000) := '';
      begin
        retval := retval || to_char(p_record.c_id) || a_separator;
        retval := retval || ... || a_separator;
        retval := retval || ... || end_line;
        return retval;
      end;
    begin
      f_handle := utl_file.fopen ('THE_DIRECTORY','the_file.ext','w',l_buffer);
      open c_h;
      open c_d;
      loop
        fetch c_h into header_r;
        exit when c_h%notfound;
        buffer_put(build_header_record(header_r));
        if c_h%rowcount > 1 and (header_r.c_id = detail_r.c_id) then
          buffer_put(build_detail_record(detail_r));
        end if;
        loop
          fetch c_d into detail_r;
          exit when c_d%notfound or (detail_r.c_id != header_r.c_id);
          buffer_put(build_detail_record(detail_r));
        end loop;
      end loop;
      if length(a_buffer) > 0 then
        utl_file.put(f_handle,a_buffer);
      end if;
      utl_file.fflush(f_handle);
      utl_file.fclose(f_handle);
    end;Regards
    Etbin
    utl_file.fclose(f_handle); instead of utl_file.fclose;
    Edited by: Etbin on 11.8.2009 8:54

  • Need Guide to create a table in SQL Server and Process data for JDBC

    Dear All,
    Scenario:JDBC to JDBC
    I need to practice JDBC to JDBC scenario and for that i need to create a table in SQL server for sender ,receiver and update  i have installed SQL Server and no idea about creation of table and Connection string for PI.
    I want you to explain each and every step for the Table Creation ,Driver and connection string.
    Thanks in Advance.

    Try searchin in the forum and then google. This forum is not for teaching the basics.
    VJ

  • New to applescript. need to create a plist file using applescript

    Needed some help I need on creatinga plist file below using applescript and I can't make it happen needed some hand on this.
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    <key>Username</key>
    <string>${localAdminUser}</string>
    <key>Password</key>
    <string>${localAdminPassword}</string>
    <key>AdditionalUsers</key>
    <array>
    <dict>
    <key>Username</key>
    <string>${userName}</string>
    <key>Password</key>
    <string>${userPassword}</string>
    </dict>
    </array>
    </dict>
    </plist>
    I have tis code but it doesn't seems to work.
    tell application "System Events"
      -- create an empty property list dictionary item
              set the parent_dictionary to make new property list item with properties {kind:record}
      -- create new property list file using the empty dictionary list item as contents
              set the plistfile_path to "~/Desktop/example.plist"
              set this_plistfile to ¬
      make new property list file with properties {contents:parent_dictionary, name:plistfile_path}
      -- add new property list items of each of the supported types
      make new property list item at end of property list items of contents of this_plistfile ¬
                        with properties {kind:string, name:"Username", value:"${localAdminUser}"}
      make new property list item at end of property list items of contents of this_plistfile ¬
                        with properties {kind:string, name:"Password", value:"${localAdminPassword}"}
      make new property list item at end of property list items of contents of this_plistfile ¬
                        with properties {kind:list, name:"AdditionalUsers"}
      make new property list item at end of property list items of contents of this_plistfile ¬
                        with properties {kind:string, name:"Username", value:"${localAdminUser}"}
      make new property list item at end of property list items of contents of this_plistfile ¬
                        with properties {kind:string, name:"Password", value:"${localAdminPassword}"}
    end tell
    The result of the above code will generate a plist file below
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
              <key>AdditionalUsers</key>
              <array/>
              <key>Password</key>
              <string>${localAdminPassword}</string>
              <key>Username</key>
              <string>${localAdminUser}</string>
    </dict>
    </plist>

    Hello
    You need to create elements at correct container. Like this.
    set plist_file to (path to desktop)'s POSIX path & "example.plist"
    --set plist_file to "~/desktop/example.plist"
    tell application "System Events"
        tell (make new property list file with properties {name:plist_file})
            make new property list item at end with properties {kind:string, name:"Username", value:"${localAdminUser}"}
            make new property list item at end with properties {kind:string, name:"Password", value:"${localAdminPassword}"}
            tell (make new property list item at end with properties {kind:list, name:"AdditionalUsers"})
                tell (make new property list item at end with properties {kind:record})
                    make new property list item at end with properties {kind:string, name:"Username", value:"${localAdminUser}"}
                    make new property list item at end with properties {kind:string, name:"Password", value:"${localAdminPassword}"}
                end tell
            end tell
        end tell
    end tell
    Or you may create a record in AppleScript and set the value of plist file at once. Like this.
    set plist_file to (path to desktop)'s POSIX path & "example.plist"
    --set plist_file to "~/desktop/example.plist"
    set dict to ¬
        {|Username|:"${localAdminUser}", |Password|:"${localAdminPassword}"} & ¬
        {|AdditionalUsers|:{¬
            {|Username|:"${localAdminUser}", |Password|:"${localAdminPassword}"} ¬
    --set dict to {|Username|:"${localAdminUser}", |Password|:"${localAdminPassword}", |AdditionalUsers|:{{|Username|:"${localAdminUser}", |Password|:"${localAdminPassword}"}}}
    tell application "System Events"
        tell (make new property list file with properties {name:plist_file})
            set value to dict
        end tell
    end tell
    Regards,
    H
    Message was edited by: Hiroto (PS. Fixed second script so that it uses the original case (uppercase)  in key string)

  • How many DNS record need to create in Internal & external DNS server for exchange?

    Hi friends,
    I recently installed Exchange Server 2010 in my organization for testing purpose and I've register a pubic ip too for exchange server on godaddy.com. How many
    internal & External DNS records reqired to configure on external & Internal dns server so my all feature like Auto-discover, Activ -sync,& webmail start working perfectly.
    It's my first time configuring exchange for a organization.
    Thanks & Regards,
    Pradeep Chaugule

    Hi,
    Just as what ManU Philip said, you need to create
    Autodiscovery.domaincom and mail.domain.com for external dns server.
    Generally, you configure your Exchange Servers as DNS clients of your internal DNS server.
    Refer from:
    http://technet.microsoft.com/en-us/library/aa996996(v=exchg.65).aspx
    Best Regards.

Maybe you are looking for

  • CD/DVD drive issues

    I was not sure where to post this, but trial and error is suggesting that this is an iTunes (possibly Mountain Lion) issue rather than a fault with my external Super Drive. I am using the current iMac (the one with no internal Superdrive) and an exte

  • Captivate 4 - after patch, published projects won't pause but skip ahead

    Last week, I installed the patch to bring my version up to Version 4.0.1 Build 1658. After the patch was installed, if I publish a file with a Table of Contents, it runs fine the first time.  However, the second time I launch the published file, the

  • Inserting text over an image in dreamweaver cc

    I am trying to insert text over an image in fluid grid layout but all i can see is the text.  I have seen the previous query relating to this but it does not help.  Help on this would be great.

  • Cannot view pdf from a secure web site

    I have no problems viewing pdf's normally. But if I am on a secure page (https://), the pdf won't load. This happens on two different web sites, both the Cox cable site and USAA insurance, I am unable to view my statements which are in pdf. I can get

  • Locating failed wireless login attempts and which access point they're hitting

    We have a cisco 5508 WLC with about 190 access points.  They use Cisco Secure ACS to authenticate Microsoft Active Directory logins.  We sometimes get non-normal accounts attempting to login to our wireless but are unable to figure out which access p