SQL statements in XML File

Folks
I need to separate SQL statements from Java Code, How do i put these SQL Statements in an XML file and how to access these SQL statements from a Java code,
Any help with sample code is greatful,

The use of entities as kstc_jyu may help. It really depends on how you design the XML vocabulary based on the expected usage (e.g., if the SQL statements change very often).
Back to the original question, I am right to interpret "how to use SQL statements in XML ?" as how to design an XML vocabulary to store SQL statements?
If not, you can simply use the scheme proposed by DrClap. Reading and extracting the SQL statement would be just as you would with any other XML document. Google for a Java XML tutorial.

Similar Messages

  • SQL Statements in XML

    Folks
    I need to separate SQL statements from Java Code, How do i put these SQL Statements in an XML file and how to access these SQL statements from a Java code,
    Any help with sample code is greatful,
    thanks
    mathew

    I looked it and they support only Perl now, Infact i saw some questions posted in some forums about having SQL statements in XML, but i am not able to get that information,Let me know if you can get any information,
    thanks
    KM

  • How to export the result from executing sql statement to excel file ?

    HI all,
    Great with Oracle SQL Developer, but I have have a trouble as follwing :
    I want to export the result from executing sql statement to excel file . I do easily like that in TOAD ,
    anyone can help me to do that ? Thanks so much
    Sigmasvn

    Hello Sue,
    I just tried to export to excel with the esdev extension and got java.lang.NumberFormatException. I found the workaround at Re: Windows Multi-language env, - how do I set English for application lang?
    open the file sqldeveloper\jdev\bin\sqldeveloper.conf and add the following two lines:
    AddVMOption -Duser.language=en
    AddVMOption -Duser.country=USyet now my date formats in excel are 'american-style' instead of german. For example 01-DEC-01 so excel does not recognize it as date and therefore I can not simply change the format.
    When export to excel will be native to 1.1 perhaps someone can have a look at this 'feature'
    Regards
    Marcus

  • Import/export data from ms sql 7 to xml file in a particular xpdl format

    I'm trying to write java program to import/export data from ms sql 7 to xml file in a particular xpdl format. Can anyone suggest how to do it?

    take a glance at what these guys do: http://www.openbusinessengine.org/docs/guide.html

  • Tkprof : 0  user  SQL statement in trace file

    Hello!
    Please explain , what is difference of tkprof-converting of user session trace file and an internal/background process ?
    Get I message "0 user SQL statement in trace file" cause this difference?
    In my target session I issued :
    begin
    sys.dbms_system.set_ev(...., .., 10046, 12, '');
    end;
    begin
    sys.dbms_system.set_ev(..., .., 10053, 1, '');
    end;
    /Thanks and regards,
    Pavel

    Did you try to tkprof a 10053 trace ?
    That is not going to show anything. 10053 traces are meant to be read as they are. tkprof is there to deal with 10046 traces.

  • Run sql statement from batch file

    How can we execute SQL Statement using Batch file???
    I did a test.
    create batch file test.bat
    sqlplus "username@db /pass" @\script.sql
    script.sql file has following statement
    select sysdate from dual;
    exit
    it is working but I want to call sql statement in the same batch file instead of calling .sql script file. how can I do that any idea..

    This is very easy in unix shell scripting, but AFAIK, not available with Windows. It's a function of how the shell/command processor handles input redirection.

  • JSP Servlet and convert the result set of an SQL Query To XML file

    Hi all
    I have a problem to export my SQL query is resulty into an XML file I had fixed my servlet and JSP so that i can display all the records into my database and that the goal .Now I want to get the result set into JSP so that i can create an XML file from that result set from the jsp code.
    thisis my servlet which will call the jsp page and the jsp just behind it.
    //this is the servlet
    import java.io.*;
    import java.lang.reflect.Array;
    import java.sql.*;
    import java.util.ArrayList;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import javax.naming.*;
    import javax.sql.*;
    public *class *Campaign *extends *HttpServlet
    *private* *final* *static* Logger +log+ = Logger.+getLogger+(Campaign.*class*.getName());
    *private* *final* *static* String +DATASOURCE_NAME+ = "jdbc/SampleDB";
    *private* DataSource _dataSource;
    *public* *void* setDataSource(DataSource dataSource)
    _dataSource = dataSource;
    *public* DataSource getDataSource()
    *return* _dataSource;
    *public* *void* init()
    *throws* ServletException
    *if* (_dataSource == *null*) {
    *try* {
    Context env = (Context) *new* InitialContext().lookup("java:comp/env");
    _dataSource = (DataSource) env.lookup(+DATASOURCE_NAME+);
    *if* (_dataSource == *null*)
    *throw* *new* ServletException("`" + +DATASOURCE_NAME+ + "' is an unknown DataSource");
    } *catch* (NamingException e) {
    *throw* *new* ServletException(e);
    protected *void *doGet(HttpServletRequest request, HttpServletResponse response)
    throws IOException, ServletException
    Connection conn = *null*;
    *try* {
    conn = getDataSource().getConnection();
    Statement stmt = conn.createStatement();
    ResultSet rs = stmt.executeQuery("select post_id,comments,postname from app.posts");
    // out.println("Le r&eacute;sultat :<br>");
    ArrayList <String> Lescomments= *new* ArrayList<String>();
    ArrayList <String> Lesidentifiant = *new* ArrayList<String>();
    ArrayList <String> Lesnoms = *new* ArrayList <String>();
    *while* (rs.next()) {
    Lescomments.add(rs.getString("comments"));
    request.setAttribute("comments",Lescomments);
    Lesidentifiant.add(rs.getString("post_id"));
    request.setAttribute("id",Lesidentifiant);
    Lesnoms.add(rs.getString("postname"));
    request.setAttribute("nom",Lesnoms);
    rs.close();
    stmt.close();
    *catch* (SQLException e) {
    *finally* {
    *try* {
    *if* (conn != *null*)
    conn.close();
    *catch* (SQLException e) {
    // les param&egrave;tres sont corrects - on envoie la page r&eacute;ponse
    getServletContext().getRequestDispatcher("/Campaign.jsp").forward(request,response);
    }///end of servlet
    }///this is the jsp page called
    <%@ page import="java.util.ArrayList" %>
    <%
    // on r&eacute;cup&egrave;re les donn&eacute;es
    ArrayList nom=(ArrayList)request.getAttribute("nom");
    ArrayList id=(ArrayList)request.getAttribute("id");
    ArrayList comments=(ArrayList) request.getAttribute("comments");
    %>
    <html>
    <head>
    <title></title>
    </head>
    <body>
    Liste des campagnes here i will create the xml file the problem is to display all rows
    <hr>
    <table>
    <tr>
    </tr>
    <tr>
    <td>Comment</td>
    <td>
    <%
    for( int i=0;i<comments.size();i++){
    out.print("<li>" + (String) comments.get(i) + "</li>\n");
    }//for
    %>
    </tr>
    <tr>
    <td>nom</td>
    <td>
    <%
    for( int i=0;i<nom.size();i++){
    out.print("<li>" + (String) nom.get(i) + "</li>\n");
    }//for
    %>
    </tr>
    <tr>
    <td>id</td>
    <td>
    <%
    for( int i=0;i<id.size();i++){
    out.print("<li>" + (String) id.get(i) + "</li>\n");
    }//for
    %>
    </tr>
    </table>
    </body>
    </html>
    This is how i used to create an XML file in a JSP page only without JSP/SERVLET concept:
    <%@ page import="java.sql.*" %>
    <%@ page import="java.io.*" %>
    <%
    // Identify a carriage return character for each output line
    int iLf = 10;
    char cLf = (*char*)iLf;
    // Create a new empty binary file, which will content XML output
    File outputFile = *new* File("C:\\Users\\user\\workspace1\\demo\\WebContent\\YourFileName.xml");
    //outputFile.createNewFile();
    FileWriter outfile = *new* FileWriter(outputFile);
    // the header for XML file
    outfile.write("<?xml version='1.0' encoding='ISO-8859-1'?>"+cLf);
    try {
    // Define connection string and make a connection to database
    Connection conn = DriverManager.getConnection("jdbc:derby://localhost:1527/SAMPLE","app","app");
    Statement stat = conn.createStatement();
    // Create a recordset
    ResultSet rset = stat.executeQuery("Select * From posts");
    // Expecting at least one record
    *if*( !rset.next() ) {
    *throw* *new* IllegalArgumentException("No data found for the posts table");
    outfile.write("<Table>"+cLf);
    // Parse our recordset
    // Parse our recordset
    *while*(rset.next()) {
    outfile.write("<posts>"+cLf);
    outfile.write("<postname>" + rset.getString("postname") +"</postname>"+cLf);
    outfile.write("<comments>" + rset.getString("comments") +"</comments>"+cLf);
    outfile.write("</posts>"+cLf);
    outfile.write("</Table>"+cLf);
    // Everything must be closed
    rset.close();
    stat.close();
    conn.close();
    outfile.close();
    catch( Exception er ) {
    %>

    Please state your problem that you are having more clearly so we can help.
    I looked at your code I here are a few things you might consider:
    It looks like you are putting freely typed-in comments from end-users into an xml document.
    The problem with this is that the user may enter characters in his text that have special meaning
    to xml and will have to be escaped correctly. Some of these characters are less than character, greater than character and ampersand character.
    You may also have a similiar problem displaying them on your JSP page since there may be special characters that JSP has.
    You will have to read up on how to deal with these special characters (I dont remember what the rules are). I seem to recall
    if you use CDATA in your xml, you dont have to deal with those characters (I may be wrong).
    When you finish writing your code, test it by entering all keyboard characters to make sure they are processed, stored in the database,
    and re-displayed correctly.
    Also, it looks like you are putting business logic in your JSP page (creating an xml file).
    The JSP page is for displaying data ONLY and submitting back to a servlet. Put all your business logic in the servlet. Putting business logic in JSP is considered bad coding and will cause you many hours of headache trying to debug it. Also note: java scriptlets in a JSP page are only run when the JSP page is compiled into a servlet by java. It does not run after its compiled and therefore you cant call java functions after the JSP page is displayed to the client.

  • How to store data into database by reading sql statements from text file

    how to write java program for storing data into database by reading sql statements from text file

    Step 1: Create a property file to add various queries.
    Step 2: Read the properties file using ResourceBundle
    Step 3: Use the jdbc to execute the query read from the property file.
    So in future if you need to change query no need do any modifications in java program. But depends on how you use the property file.

  • PL/SQL Parsing of XML File

    Hi,
    I need to use PL/SQL to read from XML file and from what I understand, create a table in the db where the data from XML file will go.
    I'm pretty new to PL/SQL and XML...how do I get started?
    Am on 10g XE on local machine, but have access to dev 10g Enterprise.
    Thanks!

    Thanks,
    I also found useful material at :
    http://java.sun.com/webservices/jaxp/dist/1.1/docs/tutorial/sax/index.html

  • FDM-generated SQL statement in log file?

    Hello all, hopefully a simple question:
    When you perform an import using FDM, I know that behind the scenes a SQL SELECT statement is composed and executed against the database server. My question: is the actual SQL statement kept in a log somewhere (so that we can see it?) In our case it's an Oracle DB server and we're using the ERPI Adapter; not sure if that's relevant. We would like to grab that SQL statement and use it as a jumping-off point for some other things.
    Thanks in advance for anything you can offer.

    The SQL Statement is not written to the log for the adapter.  The only things that are logged are what show in the adapter log file if you enable loggin for the ERPi source adapter in the "Get Data" action.    

  • URGENT-- cannot see   sql modeler contents (xml file)

    All,
    I have tried to open up a model which has been developed with earlier versions of sql modeler.
    below, I have copied the contents of the calling XML file for your comments,.
    it seems like 2.xx version and somehow it shows empty.! I searched through the sub folders and there are 100s of xml files.
    I tried 1.5.x and latest version of sql modeler no luck so far. what am I missing or any workaround please..
    thanks
    ali
    ========================
    *<?xml version="1.0" encoding="UTF-8" ?>*
    *<model version="2.0">*
    *     <version version="3.2" design_id="C6FFE67F-9E2B-07CE-8B7A-C790E645720B" />*
    *     <object>*
    *          <comment></comment>*
    *          <notes></notes>*
    *          <alter type="created">*
    *               <user>hdai</user>*
    *               <timestamp>2009-05-31 08:30:30</timestamp>*
              </alter>
              <alter type="changed">
                   <user>hdai</user>
                   <timestamp>2009-06-22 10:17:09</timestamp>
              </alter>
         </object>
         <engineering_params delete_without_origin="false" engineer_coordinates="true" engineer_generated="true" show_engineering_intree="false" apply_naming_std="false" use_pref_abbreviation="true" upload_directory="" />
         <eng_compare show_sel_prop_only="true" not_apply_for_new_objects="true" exclude_from_tree="false">
              <entity_table>
                   <property name="Name" selected="true" />
                   <property name="Short Name / Abbreviation" selected="true" />
                   <property name="Comment" selected="true" />
                   <property name="Comment in RDBMS" selected="true" />
                   <property name="Notes" selected="true" />
                   <property name="TempTable Scope" selected="true" />
                   <property name="Table Type" selected="true" />
                   <property name="Structured Type" selected="true" />
                   <property name="Type Substitution (Super-Type Object)" selected="true" />
                   <property name="Min Volumes" selected="true" />
                   <property name="Expected Volumes" selected="true" />
                   <property name="Max Volumes" selected="true" />
                   <property name="Growth Percent" selected="true" />
                   <property name="Growth Type" selected="true" />
                   <property name="Normal Form" selected="true" />
                   <property name="Adequately Normalized" selected="true" />
              </entity_table>
              <attribute_column>
                   <property name="Name" selected="true" />
                   <property name="Data Type" selected="true" />
                   <property name="Data Type Kind" selected="true" />
                   <property name="Mandatory" selected="true" />
                   <property name="Default Value" selected="true" />
                   <property name="Use Domain Constraint" selected="true" />
                   <property name="Comment" selected="true" />
                   <property name="Comment in RDBMS" selected="true" />
                   <property name="Notes" selected="true" />
                   <property name="Source Type" selected="true" />
                   <property name="Formula Description" selected="true" />
                   <property name="Type Substitution" selected="true" />
                   <property name="Scope" selected="true" />
              </attribute_column>
              <key_index>
                   <property name="Name" selected="true" />
                   <property name="Comment" selected="true" />
                   <property name="Comment in RDBMS" selected="true" />
                   <property name="Notes" selected="true" />
                   <property name="Primary Key" selected="true" />
                   <property name="Attributes/Columns" selected="true" />
              </key_index>
              <relation_fk>
                   <property name="Name" selected="true" />
                   <property name="Comment" selected="true" />
                   <property name="Comment in RDBMS" selected="true" />
                   <property name="Notes" selected="true" />
              </relation_fk>
              <entityview_view>
                   <property name="Name" selected="true" />
                   <property name="Comment" selected="true" />
                   <property name="Comment in RDBMS" selected="true" />
                   <property name="Notes" selected="true" />
                   <property name="Structured Type" selected="true" />
                   <property name="Where" selected="true" />
                   <property name="Having" selected="true" />
                   <property name="User Defined SQL" selected="true" />
              </entityview_view>
         </eng_compare>
         <changerequests id="" />
         <design type="Data Types" id="2391D8C8-FEC6-9182-ED6C-6EAE53428D29" path_id="0" main_view_id="420C75F3-BD6B-8126-6EBA-050A1FC9BE54" should_be_open="true" is_visible="false">
              <name>DataTypes</name>
              <comment></comment>
              <notes></notes>
         </design>
         <design type="LogicalDesign" id="4A0EEC77-6A89-10AC-351F-172AA6998230" path_id="0" main_view_id="83AB3B8B-90C4-D6A9-291D-A65F781E85D9" should_be_open="true" is_visible="true">
              <name>Logical</name>
              <comment></comment>
              <notes></notes>
         </design>
         <design type="RelationalModel" id="1214B08E-6B1C-9449-2769-131F7637FD5C" path_id="1" main_view_id="11A685B9-D950-8186-6160-DDAD08DAC3C0" should_be_open="true" is_visible="false">
              <name>SMARTD</name>
              <comment></comment>
              <notes></notes>
         </design>
         <design type="RelationalModel" id="A61B461D-F897-0CBF-3924-4BC3D33F3D13" path_id="2" main_view_id="2F6C7BB5-3F13-8657-DD84-BAFEF664D2D8" should_be_open="true" is_visible="false">
              <name>SMARTD(2)</name>
              <comment></comment>
              <notes></notes>
         </design>
         <design type="Process Model" id="7B21085F-9F75-F895-17AA-32592475602A">
              <name>Process Model</name>
              <comment></comment>
              <notes></notes>
         </design>
         <design type="Business Information" id="C0C1E8B7-7CDE-F345-C446-412C87D12639" path_id="0" main_view_id="null" should_be_open="true" is_visible="false">
              <name>Business Information</name>
              <comment></comment>
              <notes></notes>
         </design>
         <domains>
              <domain name="defaultdomains" role="uses" />
         </domains>
    </model>

    Philip:
    here is the Log file ( running modeler 2.0). hope it helps.
    thx
    ali
    ================LOG file==========
    2009-12-02 13:53:34,312 [main] INFO ApplicationView - Oracle SQL Developer Data Modeler Version: 2.0.0 Build: 570
    2009-12-02 13:53:36,890 [main] WARN AbstractXMLReader - There is no file with default domains (path: domains name: defaultdomains)
    2009-12-02 13:54:58,390 [Thread-3] ERROR FileManager - getDataInputStream: Can not read data
    java.io.FileNotFoundException: D:\1D_data\LADPSS\docs\reference\data_model\data_model\relational\1214B08E-6B1C-9449-2769-131F7637FD5C.xml (The system cannot find the path specified)
         at java.io.FileInputStream.open(Native Method)
         at java.io.FileInputStream.<init>(FileInputStream.java:106)
         at oracle.dbtools.crest.model.persistence.FileManager.getDataInputStream(Unknown Source)
         at oracle.dbtools.crest.model.persistence.FileManager.getDataInputStreamWithoutExtension(Unknown Source)
         at oracle.dbtools.crest.model.persistence.XMLPersistenceManager.getInputStreamFor(Unknown Source)
         at oracle.dbtools.crest.model.persistence.xml.AbstractXMLReader.getInputStreamFor(Unknown Source)
         at oracle.dbtools.crest.model.persistence.xml.AbstractXMLReader.recreateDesign(Unknown Source)
         at oracle.dbtools.crest.model.design.relational.RelationalDesign.load(Unknown Source)
         at oracle.dbtools.crest.model.design.Design.openDesign(Unknown Source)
         at oracle.dbtools.crest.swingui.ControllerApplication$OpenDesign$2.run(Unknown Source)
    2009-12-02 13:54:58,390 [Thread-3] ERROR AbstractXMLReader - Data inputstream is null (path: data_model/relational name: 1214B08E-6B1C-9449-2769-131F7637FD5C)
    2009-12-02 13:54:58,390 [Thread-3] ERROR FileManager - getDataInputStream: Can not read data
    java.io.FileNotFoundException: D:\1D_data\LADPSS\docs\reference\data_model\data_model\relational\A61B461D-F897-0CBF-3924-4BC3D33F3D13.xml (The system cannot find the path specified)
         at java.io.FileInputStream.open(Native Method)
         at java.io.FileInputStream.<init>(FileInputStream.java:106)
         at oracle.dbtools.crest.model.persistence.FileManager.getDataInputStream(Unknown Source)
         at oracle.dbtools.crest.model.persistence.FileManager.getDataInputStreamWithoutExtension(Unknown Source)
         at oracle.dbtools.crest.model.persistence.XMLPersistenceManager.getInputStreamFor(Unknown Source)
         at oracle.dbtools.crest.model.persistence.xml.AbstractXMLReader.getInputStreamFor(Unknown Source)
         at oracle.dbtools.crest.model.persistence.xml.AbstractXMLReader.recreateDesign(Unknown Source)
         at oracle.dbtools.crest.model.design.relational.RelationalDesign.load(Unknown Source)
         at oracle.dbtools.crest.model.design.Design.openDesign(Unknown Source)
         at oracle.dbtools.crest.swingui.ControllerApplication$OpenDesign$2.run(Unknown Source)
    2009-12-02 13:54:58,390 [Thread-3] ERROR AbstractXMLReader - Data inputstream is null (path: data_model/relational name: A61B461D-F897-0CBF-3924-4BC3D33F3D13)
    2009-12-02 13:54:58,390 [Thread-3] ERROR FileManager - getDataInputStream: Can not read data
    java.io.FileNotFoundException: D:\1D_data\LADPSS\docs\reference\data_model\data_model\processmodel\7B21085F-9F75-F895-17AA-32592475602A.xml (The system cannot find the path specified)
         at java.io.FileInputStream.open(Native Method)
         at java.io.FileInputStream.<init>(FileInputStream.java:106)
         at oracle.dbtools.crest.model.persistence.FileManager.getDataInputStream(Unknown Source)
         at oracle.dbtools.crest.model.persistence.FileManager.getDataInputStreamWithoutExtension(Unknown Source)
         at oracle.dbtools.crest.model.persistence.XMLPersistenceManager.getInputStreamFor(Unknown Source)
         at oracle.dbtools.crest.model.persistence.xml.AbstractXMLReader.getInputStreamFor(Unknown Source)
         at oracle.dbtools.crest.model.persistence.xml.AbstractXMLReader.recreateDesign(Unknown Source)
         at oracle.dbtools.crest.model.design.process.ProcessModel.load(Unknown Source)
         at oracle.dbtools.crest.model.design.Design.openDesign(Unknown Source)
         at oracle.dbtools.crest.swingui.ControllerApplication$OpenDesign$2.run(Unknown Source)
    2009-12-02 13:54:58,390 [Thread-3] ERROR AbstractXMLReader - Data inputstream is null (path: data_model/processmodel name: 7B21085F-9F75-F895-17AA-32592475602A)

  • Spooling Extracts from Multiple SQL statements in 1 File

    Hi all,
    I am trying to spool extract results of 3 separate SQL statements into one single file. I wrote a SQL block similar to the one below. However, the result of the statements overwrite each other: 3 overwrote 2 and overwrote 1. Any suggestion how to combined there extracted results in one file?
    spool c:\test.txt
    <SQL statement 1>
    <SQL statement 2>
    <SQL statement 3>
    /spool OFF
    Thanks in advance
    Jason

    Please paste you SQL file here. These is no way one should overwrite another.
    Eric

  • Suppressing sql statement in spool file

    I am trying to run a report in sql and I am spooling the output to a file. I cannot seem to figure out what set command will suppress the sql statement.

    Hi,
    It is "set echo off"
    Deepak

  • How to execute sql statement under bat file?

    I want to execute following statement
    C:\>sqlplus /nolog
    SQL> conn scott/tiger
    SQL> select * from tab;
    I know I can realize it as following test.bat and testdb.sql file
    test.bat is follows:
    sqlplus /nolog @testdb.sql
    testdb.sql is follows:
    conn scott/tiger
    select * from tab;
    Now I don't want to use sql file,I only want to use bat file,like follows:
    test.bat is follows:
    sqlplus /nolog
    conn scott/tiger
    select * from tab;
    when I run test.bat,I find only sqlplus /nolog statement execute,the other statements don't execute.
    1)I want to know whether there is a method to execute sql statement only by bat file without a sql file? How to realize it?
    2)If I call sql file,how to hide passord of user? Because I don't want to other persons know scott password,if I use conn scott/tiger in testdb.sql,other person can see testdb.sql and know the password. Is there a good method to avoid?
    Thanks!

    I'm running *NIX, but works the same on Windows
    bcm@bcm-laptop:~$ cat here.sh
    sqlplus dbadmin/admindb << EOF
    select count(*) from user_objects;
    exit
    EOF
    bcm@bcm-laptop:~$ sh here.sh
    SQL*Plus: Release 11.2.0.1.0 Production on Mon May 17 18:14:09 2010
    Copyright (c) 1982, 2009, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL>
      COUNT(*)
          9
    SQL> Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    bcm@bcm-laptop:~$ Edited by: sb92075 on May 17, 2010 6:15 PM

  • LIKE operator is not working in SQL Query in XML file

    Hi Gurus,
    LIKE operator is not working in SQL query in XML template.
    I am creating a PDF report in ADF using Jdeveloper10g. The XML template is as follows
    <?xml version="1.0" encoding="WINDOWS-1252" ?>
    <dataTemplate name="catalogDataTemplate" description="Magazine
    Catalog" defaultPackage="" Version="1.0">
    <parameters>
    <parameter name="id" dataType="number" />
    <parameter name="ename" dataType="character" />
    </parameters>
    <dataQuery>
    <sqlStatement name="Q1">
    <![CDATA[
       SELECT ename, empno, job, mgr from EMP where deptno=:id and ename LIKE :ename || '%']]>
    </sqlStatement>
    </dataQuery>
    <dataStructure>
    <group name="EmployeeInfo" source="Q1">
    <element name="EmployeeName" value="ename" />
    <element name="EMPNO" value="empno" />
    <element name="JOB" value="job"/>
    <element name="MANAGER" value="mgr" />
    </group>
    </dataStructure>
    </dataTemplate>
    if i pass the parameter value of :ename from UI, it doesn't filter. But if I give ename = :ename it retrieves the data. Can anyone help me why LIKE operator doesn't work here?
    Appreciate your help,
    Shyamal
    email: [email protected]

    Hi
    Well for a start, you are doing some very strange conversions there. For example...
    and to_char(a.msd, 'MM/DD/YYYY') != '11/11/2030'
    and to_char(a.msd, 'MM/DD/YYYY') != '10/10/2030'If a.msd is a date then you should e converting on the other side ie.
    and a.msd != TO_DATE('11/11/2030', 'MM/DD/YYYY')
    and a.msd != TO_DATE('10/10/2030', 'MM/DD/YYYY')Also, you may want to take into consideration nothing being input in :P2_ITEM_NUMBER like this...
    AND INSTR(a.item_number,NVL(:P2_ITEM_NUMBER,a.item_number)) > 0Is item number actually a number or char field? If it's a number, you want to explicitly convert it to a string for using INSTR like this...
    AND INSTR(TO_CHAR(a.item_number),NVL(TO_CHAR(:P2_ITEM_NUMBER),TO_CHAR(a.item_number))) > 0?
    Cheers
    Ben

Maybe you are looking for