Basic JDBC transactional question

Hello all,
I have (what I believe) is a basic transactional JDBC question.
Here's what I want to do:
begin transaction
select a row from a table where (some condition).
that row may or may not exist.
if the row exists: update the row
else if the row does not exist, insert a new row
end transaction
I want this entire thing to be atomic .. I don't want the select to complete, then have something else come in there before the update/insert takes place.
I'm using MySQL .. I seem to remember hearing about some proprietary MySQL command which would do a SELECT + UPDATE atomically .. which would be fine, but I can't find it.
Wrapping this with a row-level lock would be fine too .. I'm just not sure how to do that in JDBC.
Thanks!
-d

By thte way, and not that it helps the orignal poster, who's using MySQL, but Oracle has a proprietary MERGE statement that does "insert or update" in one go. For example:
MERGE INTO bonuses D
   USING (SELECT employee_id, salary, department_id FROM employees
   WHERE department_id = 80) S
   ON (D.employee_id = S.employee_id)
   WHEN MATCHED THEN UPDATE SET D.bonus = D.bonus + S.salary*.01
     DELETE WHERE (S.salary > 8000)
   WHEN NOT MATCHED THEN INSERT (D.employee_id, D.bonus)
     VALUES (S.employee_id, S.salary*0.1)
     WHERE (S.salary <= 8000);

Similar Messages

  • UserTransaction or JDBC transaction

    Hi,
    please give suggestions...
    We are using a application server with connection pooling
    jsp and servlets are used in project
    for transactions Is userTransaction is better or JDBC transaction is better
    userTransaction may be implemented like this
    try
    getUserTransaction
    transaction.begin
    execute queries
    transaction.commit
    catch()
    transaction.setRollbackOnly
    JDBC Transaction may be implemented like this
    connection.autoCommit=false
    try
    execute queries
    connection.commit
    catch()
    connection.rollback
    which is better for scalability and performance when we have to use transactins
    in jsp/servlets
    regards

    Hi,
    You are talking about using programmatic transactions in J2EE applications.
    When developing J2EE applications, you are recommended to use the transaction mechanism provided by the application servers.
    Sometimes, JDBC transaction can undertake the whole task. However, using JTA (Java Transaction APIs) is the better choice.
    Especially when you are going to develop a lot of components (JavaBeans/ EJBs).
    Imangine if a transaction is to be finished after the coroperation of serveral objects(JavaBean/ EJB instances).
    How can you control the begining and the ending of the transaction by puting codes in these programs?
    But it is very easy to input JTA codes (just like userTransaction etc.) to implement it.
    Therefore, to use JTA is more convinient.
    Additionally, J2EE specifications recommend to use declarative transactions in EJBs. Thus transaction management could be more flexible.
    Good luck.
    Gary Wang
    Developer Technical Support
    Sun Microsystems
    http://www.sun.com/developers/support/

  • Setting JDBC Transaction Isolation

    https://community.jboss.org/wiki/ConfigDataSources
    As explained in the above URL, with JBoss, you can set the JDBC transaction isolation level in the xml file that contains the JDBC connection information.
    I've been doing some googling, but I'm not clear on how this can be done with WebLogic. Is there some kind of external file where you can set the JDBC transaction isolation level as with JBoss, or is this some kind of change that can only be made in the application code or in some file contained within the application archive file (ear, war, etc.)?

    You can set the isolation in the deployment override weblogic-ejb-jar.xml
    - http://docs.oracle.com/cd/E21764_01/web.1111/e13719/ejb_jar_ref.htm#i1116237
    - http://docs.oracle.com/cd/E21764_01/web.1111/e13719/ejb_jar_ref.htm#i1219612

  • A jdbc transaction error occur

    Hi Everybody
    A jdbc transaction error occur when I deploy the application on the server .
    Below is the stack trace
    #SAP J2EE Engine JTA Transaction : [03bfffffffd3a000ffffffc0]####Application [13]##0#0#Error#1#/System/Audit#Java###Exception #1#com.sap.engine.services.dbpool.exceptions.BaseSQLException: Cannot commit transaction from this connection of "YTSQLS2K" DataSource. This resource participates in a local or distributed transaction.
    #SAP J2EE Engine JTA Transaction : [03bfffffffd3a000ffffffc0]####Application [13]##0#0#Error#1#/System/Audit#Java###Exception #1#com.sap.engine.services.dbpool.exceptions.BaseSQLException: Cannot initiate transaction from a connection of "YTSQLS2K" DataSource. Local or distributed transaction has already started.
    #SAP J2EE Engine JTA Transaction : [03bfffffffd3a000ffffffc0]####Application [13]##0#0#Error#1#/System/Audit#Java###Exception #1#com.sap.engine.services.dbpool.exceptions.BaseSQLException: Cannot commit transaction from this connection of "YTSQLS2K" DataSource. This resource participates in a local or distributed transaction.
    Any idea about it
    I use the jdbc version in datasource <jdbc-1.x>
    is there a need to replace it with <jdbc-2.0>
    Thank You
    Syed Saifuddin

    Hibernate allows you to choose transaction manager. As Nikolay pointed out, in a JEE envirnment it's prefferable to use JTA transactions. All you need to do is to configure hibernate to use a JTA transaction manager. It is all written in the Hibernate documentations. See
    http://www.hibernate.org/hib_docs/v3/reference/en/html_single/#configuration-j2ee
    and
    http://www.hibernate.org/42.html#A5 .
    The relevant properties that need to be set in the configuration are:
    hibernate.transaction.factory_class=org.hibernate.transaction.JTATransactionFactory
    and
    hibernate.transaction.manager_lookup_class=<Class that knows how to lookup>
    You need to implement a class that knows how to lookup user transaction in SAP J2EE Egnine.
    The class must extend org.hibernate.transaction.JNDITransactionManagerLookup and only override its abstract method getName (simply returning the lookup string). Then provide the fully qualified name as value of the property and make sure that Hibernate can load the class.
    That should work.
    HTH
    -Georgi
    Message was edited by:
            Georgi Pavlov

  • Check Infocube Basic or Transactional

    Hi all,
    I want to check if an Infocube is basic or transactional with Function Module; I've tested the return of FM RSD_CUBE_GET_ONLY_DB but in the field l_s_cube-cubetype always "B"....
    I've analyzed the FM: RSAPO_CLOSE_TRANS_REQUEST; RSAPO_SWITCH_TRANS_TO_BATCH, RSAPO_SWITCH_BATCH_TO_TRANS, ... But my problem is tested only the type of infocube (Basic or transactional) moreover if transactional even if the cube can be planned by function SEM.
    I have found the table RSMDATASTATE and the field LOADALWD... for me this field is perfect.... I want to check this by Function Module...
    you know some Function Module....
    any help is appreciated.
    regards,
    Alessandro
    Message was edited by: Alessandro Gasparro

    Thanks Paolo,
    But in this table, the field TRANSACT not change if switch te Infocube, so the field value is always "X"..., moreover the field CUBETYPE is always "B"... I do not know the operation of this table. I think that the function RSD_CUBE_GET_ONLY_DB test this table,.....
    Regards,
    Alessandro

  • Basic Hyperion Workspace question

    Is there any way to Drill-Down to data by double-clicking on the chart item in Hyperion Workspace? I can do this in Hyperion Reporting Studio.

    hi all,Hi Neerav
    I have very basic clone database question
    If i create database A and clone database B using A...
    I want to know that any operation done on A will be automatically done on Cloned database B.Oops....Now you're asking about rocket science. Sorry, I don't know.
    I know about some basics:
    Streams or Replication--> Which can give you data on B in read-write mode.
    DR--> For safeguarding your database and B will work as DR solution.
    Hope u understandNo, please make us understand.
    Regards,
    S.K.

  • Basic recording/feedback question

    I'm recording basic vocals against accompaniment tracks using an APOGEE ONE and Audio-Technica 40 series AT8449 condenser mic. I use only headphones, no external speakers.
    If I record with "monitoring" on I constantly battle feedback/distortion, especially on songs with a wide dynamic range. When the feedback protection kicks in the message indicates that I'm getting feedback through my external speakers (which I don't have), I can minimize the problem by turning "monitoring" off but I lose the reference vocal. I know I must be overlooking something very simple. Any help is appreciated.

    hi all,Hi Neerav
    I have very basic clone database question
    If i create database A and clone database B using A...
    I want to know that any operation done on A will be automatically done on Cloned database B.Oops....Now you're asking about rocket science. Sorry, I don't know.
    I know about some basics:
    Streams or Replication--> Which can give you data on B in read-write mode.
    DR--> For safeguarding your database and B will work as DR solution.
    Hope u understandNo, please make us understand.
    Regards,
    S.K.

  • Basic PDF/SSL Question

    Okay, I know this is a basic question, and I'm not sure if this is really where I should be posting it, but maybe someone out there has experience with this.
    I have a PDF form sitting on a secure server.  I have it set up to email the completed PDF back to our company when the user clicks the SUBMIT buttton.  Whether or not the PDF is secure coming back to us would be dependent on the email server the user uses - not that the form sits in a secure area on our server or that the PDF is security settings are set, correct?
    Any input appreciated.
    Thanks
    Q

    hi all,Hi Neerav
    I have very basic clone database question
    If i create database A and clone database B using A...
    I want to know that any operation done on A will be automatically done on Cloned database B.Oops....Now you're asking about rocket science. Sorry, I don't know.
    I know about some basics:
    Streams or Replication--> Which can give you data on B in read-write mode.
    DR--> For safeguarding your database and B will work as DR solution.
    Hope u understandNo, please make us understand.
    Regards,
    S.K.

  • Basic wifi service question

    basic wifi service question
    A Windows-using friend of mine subscribes to a service from Verizon that is sort of like a cell phone for a computer - wifi service that you can access from theoretically anywhere, for something like $60 a month -
    as far as I can determine, one CAN get this for Mac but ONLY if you have a 15 or 17 inch laptop with PC slots - unless I am missing something. It requires a special kyocera card.
    Another company, T-Mobile, offers a similar service, but with no MAC access at all.
    So my question is: is there a similar service, wi-fi access theoretically anywhere (or even just anywhere in New York City) ? Hopefully with just the regular mac airport card and not any additional special hardware?
    Thanks!
    Will

    Hello WillFriedwald2
    The kind of service your describing is probably a 3G and GPRS service.
    Phone companies now offer mobile high speed connections using EDGE technology or GPRS2 and supply a 3G or GPRS PCMCIA card.
    However some companies are now offering a package whereby you get high speed 3g and gprs and also wifi.
    So to use this service on a laptop that has no PC card slot you need to get a 3G or GPRS2 phone that supports blue tooth then you can connect your laptop to the phone over bluetooth and therefore access high speed internet.
    But if you had a desktop mac such as a G5 you would be better just getting a regular cable or dsl connection in your home and invest in a wireless router.

  • Basic Clone database question

    hi all,
    I have very basic clone database question
    If i create database A and clone database B using A...
    I want to know that any operation done on A will be automatically done on Cloned database B.
    Hope u understand
    Thanks,
    Neerav

    hi all,Hi Neerav
    I have very basic clone database question
    If i create database A and clone database B using A...
    I want to know that any operation done on A will be automatically done on Cloned database B.Oops....Now you're asking about rocket science. Sorry, I don't know.
    I know about some basics:
    Streams or Replication--> Which can give you data on B in read-write mode.
    DR--> For safeguarding your database and B will work as DR solution.
    Hope u understandNo, please make us understand.
    Regards,
    S.K.

  • Basic JDBC Question

    Okay, I think this isn't supposed to be in this forum (Seeing as how there's a JDBC forum and all..), but this is so basic and I'm kicking myself over it I thought I'd put it in here. Anyways:
    I just installed mysql-connector-java-2.0.14, or at least I think I did. I keep getting the "java.lang.ClassNotFoundException: com.mysql.jdbc.Driver" error. I read a lot of the forum hits I got for the error, but none of them helped me out...
    My JDK (I'm using 1.3.1_06 for compatibility reasons) is installed to /usr/java/jdk
    I'm compiling an applet on one machine, but hosting it off another. The applet must then be viewed by the compiling machine, the hosting machine, and any other machines (which I do not have access to).
    My question is this: What the hell am I doing wrong. :) Am I not understanding applets right? Does the client viewing it have to have the mysql driver installed? Does the server need it? I would assume only the compiling computer would...
    And if I only need it on the compiling machine, what am I doing wrong? My environmental variables are set as shown, I'm compiling with the shown command, and the code snippets are from my stuff. Parts in bold are what I feel is relevent (in the paths). God I feel like an idiot...
    Thanks in advance, and sorry to waste your time...
    echo $PATH
    /bin:/usr/bin:/usr/X11R6/bin:/usr/local/bin:/home/jcourts/bin:/usr/java/jdk/bin:/usr/java/jdk/jre/lib/ext:/usr/java/jdk/jre/lib/ext/mysql-connector-java-2.0.14-bin.jar
    echo $CLASSPATH
    /usr/java/jdk/jre/lib/ext:/usr/java/jdk/jre/lib/ext/mysql-connector-java-2.0.14-bin.jar
    echo $JAVA_HOME
    /usr/java/jdk
    /usr/java/jdk/bin/javac -g -deprecation *.java
    import java.sql.*;
    -and-
    Class.forName("com.mysql.jdbc.Driver");
    Connection con = DriverManager.getConnection("jdbc:mysql://<<host_is_here>>/<<db_name>>?user=<<username>>");

    Hvae program to test the ODBC or JDBC Bridge and driver, so that you know you've set it up right. I gave up on applets ages ago for this sort of thing, though I do know you have to install a seperate driver for applets, perhaps someone could come in on this and guide you more
    This will teat your driver and set-up, so compile and run this code;-
    import java.sql.*;
    import java.util.*;
    public class MyConnection
         Connection con;
         MyConnection()
              try
    // ******************************Connected To Jdbc-Odbc Type - 1 Driver
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    //               con = DriverManager.getConnection("Jdbc:Odbc:dsnname","userid","password");
                   con = DriverManager.getConnection("jdbc:odbc:Driver={SQL Server};Server=servername;Database=pubs","userid","password");
    // ******************************Connected To Ms-Access JDBC ODBC Driver .
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                   con = DriverManager.getConnection("Jdbc:Odbc:dsnname","","");
    //               con = DriverManager.getConnection("jdbc:odbc:Driver={MicroSoft Access Driver (*.mdb)};DBQ=G:/admin.mdb","","");
    // ******************************Connected To Ms-Access Type-3 Driver.
         /*          Class.forName ("acs.jdbc.Driver");
                   String url = "jdbc:atinav:servername:5000:C:\\admin.mdb";
                   String username="Admin";
                   String password="";
                   Connection con = DriverManager.getConnection(url,username,password);
    // ******************************Connected To Microsoft SQL.
                   Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
                   con = DriverManager.getConnection("jdbc:microsoft:sqlserver://servername:1433","userid","password");
    // ******************************Connected To Merant.
                   Class.forName("com.merant.datadirect.jdbc.sqlserver.SQLServerDriver");
                   con = DriverManager.getConnection("jdbc:merant:sqlserver://servername:1433;User=userid;Password=password");
    // ******************************Connected To Atinav SqlServer.
                   Class.forName ("net.avenir.jdbc2.Driver");
                   con= DriverManager.getConnection("jdbc: AvenirDriver://servername:1433/pubs","userid","password");
    // ******************************Connected To J-Turbo.
    /*               String server="servername";
                   String database="pubs";
                   String user="userid";
                   String password="password";
                   Class.forName("com.ashna.jturbo.driver.Driver");
                   con= DriverManager.getConnection("jdbc:JTurbo://"+server+"/"+database,user,password);
    /*// ******************************Connected To jk Jdbc Driver.
                   String url= "jdbc:jk:server@pubs:1433";
                   Properties prop = new Properties();
                   prop.put("user","userid");//Set the user name
                   prop.put("password","password");//Set the password
                   Class.forName ("com.jk.jdbc.Driver").newInstance();
                   con = DriverManager.getConnection (url, prop);*/
    // ******************************Connected To jNetDirect Type - 4 Driver
    /*               String sConnect = "jdbc:JSQLConnect://127.0.0.1/database=pubs&user=userid&password=password";
                   Class.forName ("com.jnetdirect.jsql.JSQLDriver").newInstance();     
                   Connection con= DriverManager.getConnection(sConnect);
    // ******************************Connected To AvenirDriver Type - 4 Driver
    //               String url= "jdbc: AvenirDriver: //servername:1433/pubs";
    //               java.util.Properties prop = new java.util.Properties ();
    //               prop.put("user","userid");
    //               prop.put("password","password");
    /*               Class.forName ("net.avenir.jdbc2.Driver");     
                   System.out.println(" Connected To AvenirDriver Type - 4 Driver");
                   con= DriverManager.getConnection("jdbc: AvenirDriver://servername:1433/pubs","userid","password");
    // ******************************Connected To iNet Sprinta2000 Type - 4 Driver
         /*          String url="jdbc:inetdae7:servername:1433";
                   String login="userid";
                   String password="password";
                   Class.forName("com.inet.tds.TdsDriver");
                   System.out.println(" Connected To iNet Sprinta2000 Type - 4 Driver");
                   con=DriverManager.getConnection(url,login,password);
    // ******************************Connected To iNet Opta2000 Type - 4 Driver
    /*               String url="jdbc:inetdae7:servername:1433";
                   String login="sagar";
                   String password="sagar";
                   Class.forName("com.inet.tds.TdsDriver").newInstance();
                   System.out.println(" Connected To iNet Opta2000 Type - 4 Driver");
                   con=DriverManager.getConnection(url,login,password);
                   DatabaseMetaData md = con.getMetaData();
                   System.out.println("Driver Name            " + md.getDriverName());
                   System.out.println("Driver Version         " + md.getDriverVersion());
                   System.out.println("Database URL is        " + md.getURL());
                   System.out.println("Database UserName is   " + md.getUserName());
                   System.out.println("Connection Name        " + md.getConnection());
                   System.out.println("Database Name          " + md.getDatabaseProductName());
                   System.out.println("Database Version       " + md.getDatabaseProductVersion());
                   System.out.println("Database ReadOnly Type " + md.isReadOnly());
                   System.out.println("MaxColumnNameLength    " + md.getMaxColumnNameLength());
                   System.out.println("MaxConnections         " + md.getMaxConnections());
                   System.out.println("");
              catch(ClassNotFoundException cnfe)
                   System.out.println(cnfe.getException());
                   System.out.println("The Specified Driver Does not Exist....");
              catch(SQLException sqle)
                   if(sqle.getErrorCode() == 0)
                        System.out.println("No Suitable Driver Found..");
                   else if(sqle.getErrorCode() == 1017)
                        System.out.println("Wrong UserName Or Password..");
                   else if(sqle.getErrorCode() == 1034)
                        System.out.println("Database not Started..");
                        System.out.println(sqle.getErrorCode());
                        System.out.println(sqle.getSQLState());
                        System.out.println(sqle);
         public static void main (String args[])
              new MyConnection();
    }

  • JDBC adapter questions

    Hello all,
    I have been playing around with the JDBC adapter on my XI sandbox to figure it out.  I read through a few guides and I almost have a good handle on it, but there is still a big question lingering.  I have configured an example scenario in which I would like to pull data out of the USR01 table from the XI database and transform some user data and place it back in the same table.  I was able to get my connections correct and have the communication channel successfully execute SQL statements to alter the data.  For example, my <b>Query SQL Statement</b> in the sender communication channel is as follows:
    SELECT * FROM USR01 WHERE BNAME='ZTEST2'
    And the <b>Update SQL Statement</b> in the sender communication channel is:
    UPDATE USR01 SET BNAME='ZTEST'  WHERE BNAME='ZTEST2'
    This works fine and when I go to transaction se16 and pull up that table I see that the username gets modified when the interface is activated.  However, I haven't really figured out exactly how to configure the communication channel / data types so that I can run a SQL statement that will populate my data type that I created for mapping.  In other words, lets say I created a data type that looks as follows:
    mt_sender
        row
             MANDT
             BNAME
             STCOD
    And I want to populate that data type with data from the USR01 table (in the corresponding fields), what would my SQL statement look like in the sender communication channel?  I read a few weblogs on how to do scenarios like this, so I built my receiving Data Type to look like this:
    mt_receiver
         STATEMENT
              ROW
                   action
                   TABLE
                   access
                        MANDT
                        BNAME
                        STCOD
    But I still don't understand how exactly XI correlates the data types / mapping and transformations to the SQL statements....
    I'm having a hard time putting this into words, but basically I'm asking a rather high level question I think.  How does XI relate the data types to the data it pulls from the SQL statements?  How do I actually get the SQL statement to populate my data types so I can do mapping and then repopulate the database table again?  Does this make sense?

    Hi Harrison,
          Also check out these JDBC structure links related to your question:
    <a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/7e/5df96381ec72468a00815dd80f8b63/frameset.htm">http://help.sap.com/saphelp_nw2004s/helpdata/en/7e/5df96381ec72468a00815dd80f8b63/frameset.htm</a>
    <a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/64/ce4e886334ec4ea7c2712e11cc567c/frameset.htm">http://help.sap.com/saphelp_nw2004s/helpdata/en/64/ce4e886334ec4ea7c2712e11cc567c/frameset.htm</a>
    <a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/4d/8c103e05df2e4b95cbcc68fed61705/frameset.htm">http://help.sap.com/saphelp_nw2004s/helpdata/en/4d/8c103e05df2e4b95cbcc68fed61705/frameset.htm</a>
    Regards,
    Subhasha Ranjan

  • Transaction questions

    Howdy all.
    I have some questions about transactions. I have a particular function that does some dynamic stuff. It creates a table dynamically, creates some indexes on the table dynamically, and grants rights to the table dynamically. I am building a string for each of these actions dynamically and executing it. Then the procedure does some other things like inserting in some tables and such. If any part of the function does not finish successfully, I would like to rollback whatever has been done. I would also like to return the initial error with original line number to the caller of the function.
    I have tried some SET TRANSACTION READ WRITE stuff with COMMIT WORK at the end of successful completion and ROLLBACK WORK in an exception handler at the end of the function. But I am having problems getting Oracle to rollback all work and return the original error to the caller.
    Here is the basic layout of what I want.
    BEGIN
    <execute immediate to create table>
    <execute immediate to create indexes on table>
    <execute immediate to grant rights to table>
    <do inserts and other non-dynamic stuff>
    EXCEPTION
    WHEN OTHERS THEN
    ROLLBACK WORK;
    RAISE <original error with line numbers>;
    RETURN (1);
    END;
    If an error happens after the creation of the table, I want the create table to be rolled back. I realize that I could just manually drop table in my exception handler, but I have several cases like this that I would like to handle with transactions instead of large exception handlers.
    Any help would be appreciated. I can explain more if needed.
    wally

    DDL issues COMMIT before and after the statement. Consequently, it cannot be rolled back. If you want to drop the tables you'll have to explicitly call the DROP statement.
    I'm not a big fan of functions to do this sort of thing, because table creation, etc ought not to be done on the fly. It should be done in a controlled fashion, in a script. Apart from anything else, a script gives you:
    (1) a record of what exactly was run, in case you need to run it again.
    (2) something that can be stowed in source control repository.
    There's no reason why the production of that script cannot be automated.
    Cheers, APC

  • Basic fi/co questions

    Hi all,
    I have to build my first fi/co form with sapscript.
    It's a duuning form and i have to present the following fields
    per invoice :
    Date laste payment
    Amount Paid
    Amount outstanding
    Amount Overdue
    Can someone tell me which tables i have to use for this?
    NB:
    The standard dunning form doesn't print this information.
    Thanks in advance.

    Hi vijay,
    Integration done with other modules are follows
    OBYC--Integration with MM module (valuation class,valuation grouping code,GL accounts against each transaction key)
    VKOA--integration with SD Module (condition type,A.A.group,account keys)
    OBYE-- Integration with HR module ( Against symbolic accounts)
    Request you not to answer any basic questions. Do not encourage the newbies or lazy OPs to spam the forum.
    Instead, report abuse if you find basic questions being asked on the forum.

  • Basic  XML Publisher Question: How to access tags in the higher levels?

    Hi All,
    We have a basic question in XML Publisher.
    We have a xml hierarchy like below:
    <CD_CATALOG>
    <CATALOG>
    <CAT_NAME> CATALOG 1</CAT_NAME>
    <CD>
    <TITLE>TITLE1 </TITLE>
    <ARTIST>ARTIST1 </ARTIST>
    </CD>
    <CD>
    <TITLE> TITLE2</TITLE>
    <ARTIST>ARTIST2 </ARTIST>
    </CD>
    </CATALOG>
    <CATALOG>
    <CAT_NAME> CATALOG 2</CAT_NAME>
    <CD>
    <TITLE>TITLE3 </TITLE>
    <ARTIST>ARTIST3 </ARTIST>
    </CD>
    <CD>
    <TITLE> TITLE4</TITLE>
    <ARTIST>ARTIST4 </ARTIST>
    </CD>
    </CATALOG>
    </CD_CATALOG>
    We need to create a report like below:
    CATALOG_NAME     CD_TITLE     CD_ARTISTCATALOG 1     TITLE1     ARTIST1
    CATALOG 1     TITLE2     ARTIST2
    CATALOG 2     TITLE3     ARTIST3
    CATALOG 2     TITLE4     ARTIST4
    So we have to loop at the level of <CD> using for-each CD. But when we are inside this loop, we cannot access the value of CAT_NAME which is at a higher level.
    How can we solve this?
    Right now, we are using the work-around of set_variable and get_Variable. We are setting the value of CAT_NAME inside an outer loop, and using it inside the inner loop using get_variable.
    Is this the proper way to do this or are there better ways to do this? We are running into troubles when the data is inside tables.

    you can use
    <?../CAT_NAME?>copy past to your template
    <?for-each:CD?> <?../CAT_NAME?> <?TITLE?> <?ARTIST?> <?end for-each?>

Maybe you are looking for

  • My time capsule will only work with one device at a time

    I just purchased the Airport time capsule.  I have it set up with my imac, but I also run a macbook air, older macbook, PC laptop, PC desktop, wii, xbox, and 3 iphones off of this device.  My issue is that my ISP does not serve more than 1 IP address

  • G570 Windows 7 microphone problems (choppy sound when recording)

    Good morning, I have a nice Lenovo G570 with Windows 7 that has been running perfectly for quite a while.  I have some old audio tracks (multi-track recordings) that I have done using Audacity on an ancient Windows XP desktop. I installed a new versi

  • Help with pricing condition??

    Hi Guyz, I have a requirement with my client, the want to supply material to an external customer at an intercompany price(ZPR9). So whenever a sales order is created for this specific customer it should pull the price from Intercompany price(ZPR9). 

  • Wls 7.0 + auto deployement descr + ejb11.DDInit = only EJB2.0?

              Hi, i'm trying to use auto deployement to make the descriptors for my ejb1.1, but           the problem is that in the weblogic.jar file, there isn't an ejb11 dir (weblogic.ant.taskdefs.ajb11.DDInit)           -> so i thought that wls was s

  • Trouble loading actions onto photoshop elements 10?

    I recently got rid of a laptop on which I had grown accustomed to PSE 7. I learned how to install actions via the following method: Download .atn file move to Photo Effects folder create a .png thumbnail with a matching name allow them to load! this