Deski SQL Queries

Hi Team,
I am using the below mentioned line of code to get the queries for webi report.
  SQLDataProvider sqlDP = (SQLDataProvider)dProvider;
  SQLContainer sqlContainer = (SQLContainer)sqlDP.getSQLContainer();
  int containerCount = sqlContainer.getChildCount();
  System.out.println("Container count :: " + containerCount);
  for(int k=0;k<containerCount;k++)
       SQLSelectStatement sqlStmt = (SQLSelectStatement)sqlContainer.getChildAt(k);
       System.out.println("The SQL Statement :: " + sqlStmt.getSQL());
The same code does not work for Deski reports.
Could you please let me know the code to get SQL query used in FullClient Dataprovider.
Env: BO XI 3.1 SP3
Regards,
Mitesh Joshi

Hello Mitesh,
You cannot get the sql for a deski report.
The Report Engine SDKs is not full complaint with Deski.
You would not be able to get the dataprovider details of a deski report using Report Engine SDKs.
Refer to SAP Note: 1395501 - Is it possible to retrieve Desktop Intelligence SQL query using Java Report Engines SDK?
Thanks,
Prithvi

Similar Messages

  • SQL Queries in BO

    Hi,
    I'm working with Business Objects 3.1 Desktop and Webi. I want to type SQL Queries but I don't know how to do it. Is it possible to create queries in BO Desktop and Webi? If so, how can I do it? I'm not Administrator, I'm only a user.
    Thanks in advance.

    Hi,
    Yes you can do by deski report.Create new report by based on Free hand SQL editor,create a connection for a database then paste sql in the editor and run.For more help login on the deski and go to the help tab and in the help you can find how to create report based on the Free hand SQL Editor.
    In webi you can achieve this thing by to create one universe and insert derived table and paste the sql.Then create classes and objects and then create webi report based on the universe.You can not create webi report direct on the Free hand SQL.
    In both of cases you have to rights to create report on Free Hand SQL editor or create universe.
    Thanks,
    Amit

  • Erratic Report Region Behavior with Dynamic SQL Queries

    I'm running HTMLDB v 1.5.1.00.12 and I've noticed some odd behavior with report regions using dynamic SQL queries. Every so often, our testers will run a page containing a dynamic sql report region and get the following error, (despite the fact the query was working only moments ago and no other developer has touched it):
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    or sometimes
    failed to parse SQL query:ORA-01403: no data found
    The only solution I've found so far is to:
    1) Make a copy of the failed report region.
    2) Disable or delete the original failed report region.
    The new copy of the report region runs without issue.
    My search of the forums turned up the following two threads, but neither provided me with a clear explanation of the cause, and how to avoid it:
    ORA-06502:PL/SQL: numeric or value error: character string buffer too small
    Re: Import Export Error (ORA-06502)
    The columns being returned are below the 4000 character limit, and the rows being returned are far less than 32k in size.
    Could this have anything to do with the way HTMLDB is internally storing the PL/SQL used to generate the dynamic SQL Query? Is there any known issue related to this with that version of HTMLDB?
    This problem occurs without any discernable pattern or consistency, making it hard to determine where I should focus my efforts in tracking down the cause.

    Hi all,
    My report seems to be behaving correctly once i set it to "Use Generic Column Names (parse query at runtime only)" :)
    Cheers,
    Joel

  • Error while running the sql queries in unix as cron job..

    Hi,
    I've configured some sql queries to run as cronjob from unix,i'm able to excute all the sql queries with out any error,after all the queries are executed,I'm getting the following error message.
    ORA-00600: internal error code, arguments: [4080], [1], [131], [], [], [], [],
    Could any one advise me why this error is being thrown?
    How to avoid this error?
    Thanks,
    Anil

    Are you running these queries through TopLink?
    If so, the error seems to be occurring on the database, when the query is being executed.
    I have never seen that error before. Performing some websearches it seems to be a general database error, potentially something to do with synchronization. Sorry I can't be of more help, perhaps the database forum can provide more insight...

  • Need help in SQL Queries using GUI controls or variables

    Hello, all
    I have a big problem (I have already had with Visual Basic a few mounths ago) with Java while writing my SQL Queries.
    I would like to know how I must do to use variable data or GUI control data in my SQL Query to select only some records.
    Here, my first Query that works without any problem (no WHERE clause !!!) :
    Statement requeteBedes = connectBedes.createStatement();
    ResultSet resultatSeries = requeteBedes.executeQuery("SELECT * FROM Series");
    initComboBoxSeries(resultatSeries);the method "initComboBoxSeries" fills a JComboBox with all the names of the series in my database.
    Here comes my problem.I would like to use the value of the selected "series" in the JComboBox to search in another table of the same Database. I made another statement but it returns a Null ResultSet :
    ResultSet resultatSearchAlbumsFromSeries = requeteBedes.executeQuery("SELECT * FROM bandes_dess WHERE  ser_nom = '" + strComboBoxSeriesSelected + "' "); The variable strComboBoxSeriesSelected contains the value of the selected line in the combobox with all the series, filled after the first query that is here above and that works very well.
    Could some one help me and tell me how I must use variables or GUI controls values in my SQL Queries or tell me if there is a place where I could find an explanation of that kind of problems (like more "advanced SQL Queries", as the ones currently used in all the Learning Java 2 books)
    Thank you all for your help.
    Christian.

    executeQuery() will never return null. At least that's what the spec says. You are probably catching an exception (probably a syntax error caused by a single quote in strComboBoxSeriesSelected) and ignoring it. Or do you mean the ResultSet contains no rows?
    Anyway, to use parameterized queries, take a look at PreparedStatements. Your code should look like this using PreparedStatement:Statement requeteBedes = connectBedes.prepareStatement("SELECT * FROM bandes_dess WHERE  ser_nom = ?");
    requeteBedes.setString(1, strComboBoxSeriesSelected);
    ResultSet resultatSeries = requeteBedes.executeQuery();Alin.

  • How to get the SQL queries based on SQL_ID.

    Hi Experts,
    I want to get the SQL queries based on SQL_ID.
    I have tried the following query,but I am not getting full query.
    [code]SET linesize 132 pagesize 999
    column sql_fulltext format a60 word_wrap
    break on sql_text skip 1
    SELECT   REPLACE (TRANSLATE (sql_text, '0123456789', '999999999'), '9', ''),sql_id
    FROM   dba_hist_sqltext s
    WHERE   s.sql_id = '7tvurftg8zryb';[/code]
    One of my friend said use grid to get full query text.
    Can you please help me how to use grid ,else any other method to get the full query based on SQL_ID.
    Please help me.
    Thanks in advance.

    You have these many options to set, if sql_text is really huge. But better use a tool(TOAD) as it's really helpful and easy to use instead! (See my previous comment).
    column sql_text format A10000
    set echo off
    set head off
    set feed off
    set verify off
    set termout off
    set lines 10000
    set long 1000000
    set trimspool on
    set pages 0
    Thanks!

  • Developing portlets for dummies (sql queries)

    Hello, I've been trying to build a dynamic menu. First I went with just plain old plsql: i created a function in the portal schema that returns an unordered, nested list of the pages in my pagegroup and called that function in a regular pl/sql item on my portal page. I did this by querying the wwpob_page$ table and that went just great in my test&development setup (of which I am the admin of course :))
    Then I realized that since I'm not an administrator of the server hosting our portal and I only have very limited privileges (I am only a page group administrator) I will probably not be allowed to utilize this function nor will they agree to install it in the portal schema, and I decided I should build a portlet that does the same thing (so it can be registered and so on, and so it can use the synonyms and tools that are available to registered providers). There already is such a portlet (and provider) registered for use in the target portal, but I don't like it because i uses tables and hard-coded styles so I will cook my own, better version. :)
    So I downloaded an example portlet and am getting the hang of it, but now I just can't for the life of me figure out how to enable any sql-queries. I have run the provsyns-.sql script, logged in as test_provider/portal and installed my portlet-package as test_provider user. I can see the available pl/sql packages in Toad, but there are no tables or views for me to to see. That means I can't query the portal tables that I need to.
    edit: ok, stupid user error; I suck at using Toad, so I was looking at the wrong schema altogether :D So now i see the public views and packages, so forget that bit of the question.
    But still, I cannot see even wwsbr_all_folders -view, much less the wwpob_page$ -table. I cannot see any way to find the pages that are in my page group. Somehow it must be doable, right?
    Have I done something wrong, missed a step in enabling my test-provider / schema perhaps? I don't really know what I'm doing, but I followed instructions here: http://home.c2i.net/toreingolf/oracle/portal/my_first_plsql_portlet.htm (excellent instructions, thanks!)
    So should my portlet be able to access those tables or not? How the heck has the third partly portlet maker done it?
    i'm on OracleAS Portal 10g Release 2 (10.1.4)
    Edited by: Baguette on 23-Apr-2009 05:13
    Edited by: Baguette on 23-Apr-2009 05:32

    i see your perspective now. and let me give a perspective to my first reply too.
    what i proposed to you was the answer of what i quoted in the message. that is, why didn't you see those views in the new schema you created! and it is still ok but it is done in the portal schema for which you should have privielges too and i assumed you had. my mistake!
    now, i can relate your privacy concerns with your earlier message:
    Hello, I've been trying to build a dynamic menu. First I went with just plain old plsql: i created a function in the portal schema that returns an unordered, nested list of the pages in my pagegroup and called that function in a regular pl/sql item on my portal page. I did this by querying the wwpob_page$ table and that went just great in my test&development setup (of which I am the admin of course :))
    +Then I realized that since I'm not an administrator of the server hosting our portal and I only have very limited privileges (I am only a page group administrator) I will probably not be allowed to utilize this function nor will they agree to install it in the portal schema, and I decided I should build a portlet that does the same thing (so it can be registered and so on, and so it can use the synonyms and tools that are available to registered providers). There already is such a portlet (and provider) registered for use in the target portal, but I don't like it because i uses tables and hard-coded styles so I will cook my own, better version. :)+
    +So I downloaded an example portlet and am getting the hang of it, but now I just can't for the life of me figure out how to enable any sql-queries. I have run the provsyns-.sql script, logged in as test_provider/portal and installed my portlet-package as test_provider user. I can see the available pl/sql packages in Toad, but there are no tables or views for me to to see. That means I can't query the portal tables that I need to.+
    - by downloading an example portlet, you probably mean you created a new schema. because provsyns work on a schema.
    - if you are not the administrator of the portal, and may not be able to access some portions of the portal, it means that you do not use the portal user (the user which serves as the owner of the portal schema).
    - now, your plan to create a new schema and give those privielges would still not work. because, by creating a new schema you cannot sneak in to the oriignal portal schema if you do not have privileges to do it. obvious, right? otherwise, it would be a vulnerability of the software that you can see what you are not allowed to see by creating a new schema.
    - however, there is a bright side here. the views give records based on your privileges.
    - so if your administrators have generated them already or if they generate on the original portal schema, then you may see the pages and items that you have privileges to see and no more.
    so now, you may ask the administrators if they have already done it, and if not, then if they would be willing to do it.
    hope that helps!
    AMN

  • Ruby code for sql queries

    Hello everybody,
    First off, let me apologize if my inquiry does not belong on this forum. I am confident however, that someone here has had experience with this since Oracle and ruby on rails/ruby are used frequently. My fingers are crossed, here's is my problem:
    I am currently working on a database system that utilizes ruby on rails
    with a oracle database. Here's the situation:
    the ruby on rails web application is up and running;
    my oracle database is full of tables that are populated with data;
    there is a successful connection between rails and my oracle database;
    however, what isn't finished is I currently have data mining queries in
    sql (eg. find minimum time someone has been employed = "Select
    min(time) from table...etc") and what I need to do is write one ruby
    program for each of my sql queries so that the ruby program:
    1) connects to the oracle database each time the query is called
    2) runs the sql query on the oracle database
    3) takes the results from the query and returns them in an array or
    something of that nature (so that I can use the results in an html file
    on the ruby on rails web application).
    Again, I apologize if this question does not belong on this forum. If someone however has experience with this could you please give me example code of what this would look like (using different sql queries). Thank you

    I apologize if this question does not belong on this forum. OTN does have a forum dedicated to Ruby/Ruby On Rails. I admit it doesn't seem to get much traffic. I think that's because most people working with Ruby tend to go for F/OSS products.
    Cheers, APC
    Blog : http://radiofreetooting.blogspot.com/

  • SQL queries parser.

    Hello,
    I have quite strange question related to my research.
    Probabley within Oracle DB there is some dynamic library which is parsing SQL queries,
    for example.
    SELECT * FROM schema.table which is able to extract informations from SQL listed above that we want to display all columns from selected table.
    When this construction is valid ( SQL standard ) the next step is verification the object existence in DB. It means
    that there are two separated actions which are analyzing queries.
    I need only first part of that process, which will give me informations about all object used in SQL query
    is it possible to accomodate that internal parser witin stand alone middleware like Weblogic Event Server ?
    I can do it with regular expression patters, but it's not going to be fast and effective for subqueries and all advanced
    constructions for DHW like MODEL, etc.
    Thank You,
    R.

    >
    http://search.cpan.org/~rehsack/SQL-Statement-1.23/lib/SQL/Statement.pm
    BUGS AND LIMITATIONS ^
    * currently we treat NULL and '' as the same - eventually fix
    * No nested C-style comments allowed as SQL99 says
    >
    That's the reason why I want to use dedicated for 11g EE library ;-)
    Thanks for quick reply

  • ? in SQL Queries and not using prepared statements

    Using EclipseLink 1.1.1
    Prepared Statements are disabled
    In our production server something went wrong and one of our Read Queries started erroring. A DatabaseException was thrown and we log the "getQuery.getSQLString()" statement. We found this query in the logs:
    SELECT t1.ID, t1.NAME, t1.DESCRIPTION, t1.EXTREFID, t1.STYLESHEET, t1.DDSVNVERSION, t1.FIRSTNAME, t1.LASTNAME, t1.EMAILADDR, t1.PHONENUMBER, t1.ADDRESS, t1.ADDRESS2, t1.CITY, t1.STATE, t1.POSTALCODE, t1.COUNTRY, t1.ADMINACCTNAME, t1.HASDOCUMENTS, t1.HASTIMEDNOTIFICATIONS, t1.STATUS, t1.ENTRYDATE, t1.EVALEXPDATE, t1.LASTREMINDDATE, t1.FULLUSERS, t1.LIMUSERS, t1.REQUSERS, t1.ISENTERPRISE, t1.EXPDATE, t1.ISDISABLED, t1.DISABLEDDATE, t1.NEEDLICENSEAGREEMENT, t1.ISWARNINGDISABLED, t1.LOCALE, t1.TIMEZONE, t1.CURRENCY, t1.DOMAIN, t1.DOCUMENTSIZE, t1.EXTRADOCUMENTSTORAGE, t1.ONDEMANDOPTIONS, t1.SSOTYPE, t1.RESELLERID, t1.ACCOUNTREPID, t1.LASTUSAGEREPORTDATE, t1.NEXTUSAGEREPORTDATE, t1.USAGEREPORTATTEMPTS FROM T_SSOOPTIONS t0, T_CUSTOMERS t1 WHERE *((((t0.SSOENABLED = ?) AND (t1.SSOTYPE IN (?, ?))) AND (UPPER(t1.DOMAIN) = ?)) AND (t0.CUSTOMERID = t1.ID))*
    Notice the values weren't entered into the where clause. We had to bounce the application to fix the problem. I've never seen this before. I've added more debugging statements to the code - so if this happens again in the future I'll have more information to report on. In the mean time I'm wondering if anyone else has every seen a problem of this nature.

    Database error due to invalid SQL statement.
    I don't have a stack, we were catching the exception and not printing the stack :(
    Like I mentioned in my first post, I added more debugging code (e.printStackTrace()). I understand this is hard to track down without more information. I was just hoping you guys had seen something like this before and had any insight. Like I mentioned before: this is on our production server. I've never seen this type of error before. That particular server (we run in a cluster mode) had been up for several days and then started generating that error. IT bounced the node and everything went back to normal. We have been using toplink for about 5 years now and have never seen this problem, until August 3rd 2009. The only thing that has changed recently is our migration from toplink 10 to EclipseLink. I was wondering if anyone knows if anything had changed in EclipseLink/toplink 11 with the generation of SQL queries.
    I'll keep looking. There is more debugging code in there now. Since the error was "Database error due to invalid SQL statement" this implies the SQL was generated, exited that part of the code and was sent to the db where it failed. I'm afraid the printStackTrace won't help if this error happens again.

  • SQL queries in JSP

    Does anyone know how to create a JSP which allows the user to input data into a simple database and then allow the user to input SQL queries? I can do this in a servlet but must hard code the query. It would be great to be able to type in differnet queries to see the results.
    Thanks
    Michael

    hai,
    I am giving u a small example which allows user to enter data in the html page and the same is submitted by the Jsp page in the database.
    <%@ page language="java" import="java.sql.*" %>
    <html>
    <body bgcolor="#FFd08d" >
    <%!     Connection conn;
         Statement st,st1;
         ResultSet rs,rs1;
         int i,j;
    %>
    <%     
         try{
              Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
              conn=DriverManager.getConnection("jdbc:odbc:--DSNName--","--DataBaseUserName--","--DataBasePassword--");
         catch(Exception e)
    %>
         Error in Saving : <%=e%>
    <%
         try
         String email_address=request.getParameter("email_address");
         String query_text=request.getParameter("query_text");     
         PreparedStatement st=null;
         String inst="insert into databasename..DataBaseTableName(email_address,query_text) values (?,?)";
         st=conn.prepareStatement(inst);
         st.setString(1,email_address);
         st.setString(2,query_text);
         st.executeUpdate();
         conn.close();
    %>
    Your query is Submitted.<br>
    Thanks.
    <%
         catch(SQLException e)
    %>
    Error in Saving : <%=e%>
    <%
    %>          
    </body>
    </html>
    I think this will solve ur query.
    bye
    sameer

  • [DW 8.02 + PHP] how to use variables in advanced SQL queries

    Hi all,
    I can't find a way to use variables in an SQL query after
    updating
    dreamweaver 8.02.
    I always get error messages that says: 'missing variable
    type:myvariablename', undefined#myvariablename... and so on.
    What is the correct way to use variables?
    I usually set a variable in a PHP statement (example: <?
    $today=date('Y-m-d'); ?>)
    and then I compare this variable in the SQL query.
    What is the correct syntax for variable in DW 8.02 in
    advanced SQL
    queries?
    TIA
    tony

    sweetman wrote:
    > I'm editing a website created with DW 8.01 and MX
    Kollection.
    >
    > I updated DW to 8.02 and now I can't edit an existing
    SQL query.
    > I always get an error message 'Missing variable type'
    and I can't go
    > on.
    InterAKT released a new version of Kollection to cope with
    the 8.0.2
    changes. AFAIK, you should be able to download the updated
    version from
    your InterAKT account area.
    David Powers, Adobe Community Expert
    Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
    Author, "PHP Solutions" (friends of ED)
    http://foundationphp.com/

  • Multiple SQL Queries in SAP BPC  5.1 EVMODIFY

    Hi All,
    We have multiple SQL Queries in Outlooksoft 4.2 which extracts data from Oracle source system with different set of selections and conditions and parameters. We were able to use multiple SQL Queries in Outlooksoft 4.2 using Transform Data Flow Task and paste parameters using evModify dynamic script task, where ever extract to source system is needed.
    According to  SAP BPC 5.1, all these multiple SQL Queries and extracts by passing parameters will be coded in EVMODIFY dynamic script editor.But, EVMODIFY dynamic script editor is not working with the sets of multiple SQL Queris.It's able to recognize and execute the first SQL Query, but not able to execute from the second SQL Query.
    Does any body, did multiple extracts using SQL Queries to the source system by passing parameters using SAP BPC 5.1 data  manager and SSIS Packages, please let me know, how you did achieve the above functionality.
    Regards,
    Sreekanth.

    Hi Sorin,
    Thanks for your update, I tried declaring the variable between %%....GLOBAL(%GTIMEID%,%SELECTION%) and the package runs now but the problem is that the package is executed using the default date value for the variable GTIMEID declared in the DTSX package and its not taken the date that I'm trying to pass from BPC.  As showed below, please if you could take a look to the ModifyScript and see the last line for the global variable and line 13  PROMTP(SELECTINPUT,%SELECTION%,,,%TIME_DIM%) where I am selecting the TIMEID:
    DEBUG(ON)
    PROMPT(INFILES,,"Import file:",)
    PROMPT(TRANSFORMATION,%TRANSFORMATION%,"Transformation file:",,,Import.xls)
    PROMPT(RADIOBUTTON,%CLEARDATA%,"Select the method for importing the data from the source file to the destination database",0,{"Merge data values (Imports all records, leaving all remaining records in the destination intact)","Replace && clear data values (Clears the data values for any existing records that mirror each entity/category/time combination defined in the source, then imports the source records)"},{"0","1"})
    PROMPT(RADIOBUTTON,%RUNLOGIC%,"Select whether to run default logic for stored values after importing",1,{"Yes","No"},{"1","0"})
    PROMPT(RADIOBUTTON,%CHECKLCK%,"Select whether to check work status settings when importing data.",1,{"Yes, check for work status settings before importing","No, do not check work status settings"},{"1","0"})
    INFO(%TEMPFILE%,%TEMPPATH%%RANDOMFILE%)
    PROMPT(SELECTINPUT,%SELECTION%,,,%TIME_DIM%)
    TASK(CONVERT Task,INPUTFILE,%FILE%)
    TASK(CONVERT Task,OUTPUTFILE,%TEMPFILE%)
    TASK(CONVERT Task,CONVERSIONFILE,%TRANSFORMATION%)
    TASK(CONVERT Task,STRAPPSET,%APPSET%)
    TASK(CONVERT Task,STRAPP,%APP%)
    TASK(CONVERT Task,STRUSERNAME,%USER%)
    TASK(Dumpload Task,APPSET,%APPSET%)
    TASK(Dumpload Task,APP,%APP%)
    TASK(Dumpload Task,USER,%USER%)
    TASK(Dumpload Task,DATATRANSFERMODE,1)
    TASK(Dumpload Task,CLEARDATA,1)
    TASK(Dumpload Task,FILE,%TEMPFILE%)
    TASK(Dumpload Task,RUNTHELOGIC,1)
    TASK(Dumpload Task,CHECKLCK,1)
    GLOBAL(%GTIMEID%,%SELECTION%)
    Do you guess That I am missing something?
    Thanks in advanced
    Regards

  • How to use database control to execute sql queries which change at run time

    Hi all,
    I need to execute sql queries using database controls , where the sql changes
    at run time
    based on some condition. For eg. based on the condition , I can add some where
    condition.
    Eg. sql = select id,name from emp where id = ?.
    based on some condition , I can add the following condition .
    and location = ?.
    Have anybody had this kind of situation.
    thanks,
    sathish

    From the perspective of the database control, you've got two options:
    1) use the sql: keyword to do parameter substitution. Your observation
    about {foo} style sbustitution is correct -- this is like using a
    PreparedStatement. To do substitution into the rest of the SQL
    statement, you can use the {sql: foo} substitution syntax which was
    undocumented in GA but is documented in SP2. Then, you can build up
    the filter clause String yourself in a JPF / JWS / etc and pass it into
    the DB control.
    For example:
    * @jc:sql statement="select * from product {sql: filter}"
    public Product[] getProducts(String filter) throws SQLException;
    This will substitute the String filter directly into the statement that
    is executed. The filter string could be null, "", "WHERE ID=12345", etc.
    2) you can use the DatabaseFilter object to build up a set of custom
    sorts and filters and pass that object into the DB control method.
    There have been other posts here about doing this, look for the subject
    "DatabaseFilter example".
    Hope that helps...
    Eddie
    Dan Hayes wrote:
    "Sathish Venkatesan" <[email protected]> wrote:
    Hi Maruthi,
    The parameter substituion , I guess is used like setting the values for
    prepared
    statements.
    What I'm trying to do , is change the sql at run time based on some condition.
    For example ,
    consider the following query :
    select col1,col2 from table t where t.col3 > 1
    At run time , based on some condition , I need to add one more and condition.
    i.e. select col1,col2 from table t where t.col3 > 1 and t.col4 < 10.
    This MAY not address your issue but if you are trying to add "optional" parameters
    you may try including ALL the possible parameters in the SQL but send in null
    for those params that you don't want to filter on in any particular case. Then,
    if you word your query
    as follows:
    select col1, col2 from table t where t.col3 > 1 and (t.col4 = {col4param} or
    {col4param} is null) and (t.col5 = {col5param} or {col5param} is null) ...
    you will get "dynamic" filters. In other words, col4 and col5 will only be
    filtered if you send in non-null parameters for those arguments.
    I have not tried this in a WL Workshop database control but I've used
    this strategy dozens of times in stored procedures or jdbc prepared statements.
    Good luck,
    Dan

  • Need help for SQL Queries Tunning

    hi all,
    we have a procedure for search consumers, which using sql queries like:
    SELECT TRIM (NAME) AS NAME, TRIM (accno) AS accno,
    TRIM (connaddress) AS connaddress,
    TRIM (CATEGORY) AS CATEGORY, TRIM (landmark) AS landmark,
    SUBSTR (accno, 1, 3) AS subdivisionname
    FROM consumermaster
    WHERE LOWER (accno) LIKE
    LOWER ('%' || NVL (caccno, '#noval#') || '%')
    OR LOWER (NAME) LIKE LOWER ('%' || NVL (cname, '#noval#') || '%')
    OR LOWER (connaddress) LIKE
    LOWER ('%' || NVL (cadd, '#noval#') || '%')
    OR phone LIKE '%' || NVL (cphone, '#noval#') || '%'
    OR accno = (SELECT accno
    FROM requestregistration
    WHERE requestid = creqid)
    UNION
    SELECT TRIM (NAME) AS NAME, TRIM (accno) AS accno,
    TRIM (connaddress) AS connaddress, TRIM (CATEGORY)
    AS CATEGORY,
    TRIM (landmark) AS landmark,
    SUBSTR (accno, 1, 3) AS subdivisionname
    FROM scodetails
    WHERE LOWER (accno) LIKE
    LOWER ('%' || NVL (caccno, '#noval#') || '%')
    OR LOWER (NAME) LIKE LOWER ('%' || NVL (cname, '#noval#') || '%')
    OR LOWER (connaddress) LIKE
    LOWER ('%' || NVL (cadd, '#noval#') || '%')
    OR phone LIKE '%' || NVL (cphone, '#noval#') || '%'
    OR accno = (SELECT accno
    FROM requestregistration
    WHERE requestid = creqid);
    it's ok for small tables but now data increase .......
    searching method is very slow
    now i want to tune this query for better performance
    please sugg me best method
    Thanks in advance
    Regards
    vij..

    The link given by Asif should get you on the right track for tuning this query.
    I just formatted your SQL:
    SELECT Trim(NAME)        AS NAME,
           Trim(accno)       AS accno,
           Trim(connaddress) AS connaddress,
           Trim(category)    AS category,
           Trim(landmark)    AS landmark,
           Substr(accno,1,3) AS subdivisionname
    FROM   consumermaster
    WHERE  Lower(accno) LIKE Lower('%'
                                   ||Nvl(caccno,'#noval#')
                                   ||'%')
            OR Lower(NAME) LIKE Lower('%'
                                      ||Nvl(cname,'#noval#')
                                      ||'%')
            OR Lower(connaddress) LIKE Lower('%'
                                             ||Nvl(cadd,'#noval#')
                                             ||'%')
            OR phone LIKE '%'
                          ||Nvl(cphone,'#noval#')
                          ||'%'
            OR accno = (SELECT accno
                        FROM   requestregistration
                        WHERE  requestid = creqid)
    UNION
    SELECT Trim(NAME)        AS NAME,
           Trim(accno)       AS accno,
           Trim(connaddress) AS connaddress,
           Trim(category)    AS category,
           Trim(landmark)    AS landmark,
           Substr(accno,1,3) AS subdivisionname
    FROM   scodetails
    WHERE  Lower(accno) LIKE Lower('%'
                                   ||Nvl(caccno,'#noval#')
                                   ||'%')
            OR Lower(NAME) LIKE Lower('%'
                                      ||Nvl(cname,'#noval#')
                                      ||'%')
            OR Lower(connaddress) LIKE Lower('%'
                                             ||Nvl(cadd,'#noval#')
                                             ||'%')
            OR phone LIKE '%'
                          ||Nvl(cphone,'#noval#')
                          ||'%'
            OR accno = (SELECT accno
                        FROM   requestregistration
                        WHERE  requestid = creqid); You are using some function on almost each and every column in the where clause. Try getting rid of them as they are hindering the use of indexes, if any, on any of the columns.
    Also the guidelines in the link provided are the best starting point.

Maybe you are looking for