How to check the sql:query is return null value

I have use :
<sql:query var="sql1" dataSource="${db}">
select col_name from table_name
where a=<c:out value="${row.test1}"/>
and b='<c:out value="${row.test2}"/>'
So, how can I check this statement return null value which is no record within this table?

The Result should never be null but can be empty. You can check if the Result is empty using an if tag and checking the rowCount property:
    <sql:query var="books"
      sql="select * from PUBLIC.books where id = ?" >
      <sql:param value="${bookId}" />
     <c:if test="${books.rowCount > 0}">
Look for query Tag Result Interface

Similar Messages

  • How to view the sql query?

      how to view the sql query formed from the xml structure in the receiver jdbc?

    You can view SAP Note at
    But you require SMP login ID for this which you should get from your company. The content of the notes are as follows:
    Reason and Prerequisites
    You are looking for additional parameter settings. There are two possible reasons why a feature is available via the "additional parameters" table in the "advanced mode" section of the configuration, but not as documented parameter in the configuration UI itself:
    Category 1: The parameter has been introduced for a patch or a SP upgrade where no UI upgrade and/or documentation upgrade was possible. In this case, the parameter will be moved to the UI and the documentation as soon as possible. The parameter in the "additional parameters" table will be deprecated after this move, but still be working. The parameter belongs to the supported adapter functionality and can be used in all, also productive, scenarios.
    Category 2. The parameter has been introduced for testing purposes, proof-of-concept scenarios, as workaround or as pre-released functionality. In this case, the parameter may or may not be moved to the UI and documentation, and the functionality may be changed, replaced or removed. For this parameter category there is no guaranteed support and usage in productive scenarios is not supported.
    When you want to use a parameter documented here, please be aware to which category it belongs!
    The following list shows all available parameters of category 1 or 2. Please note:
    Parameter names are always case-sensitive! Parameter values may be case-sensitive, this is documented for each parameter.
    Parameter names and values as documented below must be used always without quotaton marks ("), if not explicitly stated otherwise.
    The default value of a parameter is always chosen that it does not change the standard functionality
    JDBC Receiver Adapter Parameters
    1. Parameter name: "logSQLStatement"
                  Parameter type: boolean
                  Parameter value: true for any string value, false only for empty string
                  Parameter value default: false (empty String)
                  Available with: SP9
                  Category: 2
                  When implementing a scenario with the JDBC receiver adapter, it may be helpful to see which SQL statement is generated by the JDBC adapter from the XI message content for error analysis. Before SP9, this can only be found in the trace of the JDBC adapter if trace level DEBUG is activated. With SP9, the generated SQL statement will be shown in the details page (audit protocol) of the message monitor for each message directly.
                  This should be used only during the test phase and not in productive scenarios.

  • Write the sql query to find largest value in row wise without using   great

    write the sql query to find largest value in row wise without using
    greatest fuction?

    Another not so good way, considering you want greatest of 4 fields from a single record:
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (Select 100 col1,200 col2,300 col3,400 col4 from dual
      2  union select 500,600,700,800 from dual
      3  union select 900,1000,1100,1200 from dual
      4  union select 1300,1400,1500,1600 from dual
      5  union select 1700,1800,1900,2000 from dual
      6  union select 2100,2200,2300,2400 from dual
      7  union select 2800,2700,2600,2500 from dual
      8  union select 2900,3000,3100,3200 from dual)
      9  SELECT (CASE WHEN col1 > col2 THEN col1 ELSE col2 END) Max_value
    10  FROM
    11  (SELECT (CASE WHEN col1_col2 > col2_col3 THEN col1_col2 ELSE col2_col3 END) col1,
    12         (CASE WHEN col2_col3 > col3_col4 THEN col2_col3 ELSE col3_col4 END) col2,
    13         (CASE WHEN col3_col4 > col4_col1 THEN col3_col4 ELSE col4_col1 END) col3
    14  FROM
    15  (SELECT (CASE WHEN col1 > col2 THEN col1 ELSE col2 END) col1_col2,
    16         (CASE WHEN col2 > col3 THEN col2 ELSE col3 END) col2_col3,
    17         (CASE WHEN col3 > col4 THEN col3 ELSE col4 END) col3_col4,
    18         (CASE WHEN col4 > col1 THEN col4 ELSE col1 END) col4_col1
    19* FROM t))
    SQL> /
    8 rows selected.
    SQL> Edited by: AP on Sep 21, 2010 6:29 AM

  • Help! how to check the SQL run in Oracle?

    Hi all,
    I have a problem. the developer said the SQL written in Java code are not the one executed in Oracle DB. that mean the query is some how manipulated by some PL/SQL so the final query run in Oracle is different. So can someone teach me how to check the actual SQL run in Oracle?
    Thanks a lot.

    Hi Michel Thanks. But it looks like the query stored in v$sqlarea is not the final executable SQL. for example, the code in application is "select column_A from default_table where column_A = ?" and this ? will be given some value in run time. the query stored in v$sqlarea will be like "select column_A from default_table where column_A = :1"... what is this :1?
    Also if some PL/SQL procedure appends some condition to the SQL, is it possible to view the full query from database side?
    ok, let me try trace and tkprof first.

  • How to check the SQL error message to address the application issue

    The application runs SQLs against Oracle via oracle client(actually the app is IBM Cognos which shows report and the data is from oracle database). So, for a report which fails to run, I want to check the sql and the error message for this failed sql statement. Where is the message stored, client or server and How to get it?
    I know there is a view v$log used to check the sqls ran in database but here I mean the failed sqls....
    Ricky Ru

    969543 wrote:
    The application only presents the application error message.. And it is not helpful for me to get the root cause..The application uses the Oracle Call Interface to communicate with the database server. OCI calls return a result code to the client. The client is expected to call OCIErrorGet() to get the full error text.
    If the client does not do this, or obfuscate the server error, or suppress the server error? Crappy client. The lack of the client to play its role as client, correctly within the documented client-server architecture, is solely the client's problem. Not the server.
    For DB2, I could use db2diag to check the log. why oracle can not do this? any thoughts?Because Oracle is not stupid? Why on sweet mother earth waste server resources to track client application errors, on behalf of clients? How does this make ANY sense!?
    Oracle server's handles 1000's of SQL executions per second. Just where is it to find sufficient space to log application errors (not database system errors) at that rate? How do you justify that overhead? Using the argument that the application is poorly designed or written? Come on!

  • How to check the source query of tabular form ....

    Hi All ,
    is there any way to change the source query of tabular form ......
    ya ... i could see it in the source but it is normal sql query ....
    where as to generate the addrow functionality the sql query must be
    Select empno , ADD_ITEM.TEXT(1,empno), ename ,ADD_ITEM.TEXT(2,ename)................
    then where can i find this query .?
    i could see that ADD button is calling ADDROW process and which inreturn calling ADD function ....
    can any one tell me , where to see the code for this ADD function ....
    as i checked it in db ..... it is not there at all.

    You can have a look here for the manual tabular forms:
    Denes Kubicek

  • How to view the sql query generated in query designer..?

    Hi experts,
       Can i view the sql query generated by the query designer for a query in sap bw?

    Hi Sivam,
    You can definitely view the sql query.
    Go to RSRT and give the report name. Then goto Execute+Debug and click on it.
    A new window will open, there tick the box  Display SQL/BIA Query and the press on the ok button.
    Finally click on execute. The Sql query will be displayed.
    Hope this helps.

  • How to display the SQL query's date parameters to the report

    Hi all,
    I'd like to take the date parameters that are contained in my query and have them appear on the report and/or have the sysdate appear on the report. Any ideas on how to do this? Thanks!

    To display parameters which are part of SQl Query in the output..

  • How to findout the sql query elapsed time for last call

    RDBMS vesrion:
    How can I get the stats like how much time it took for a query to run if I know the "sql_id"
    I can query v$sql and find out the "parse_calls","fetches","execution","elapsed_time" (microsecs)
    but if the query executed 20 times then the elapsed time will be the cumulative of all the executions.
    But I want to know the ELAPSED TIME of LAST CALL(last execution only) for that sql_id.
    Edited by: rcc50886 on Aug 2, 2012 8:35 AM

    You can easily monitor the statement and see the results for v$sql_monitorWe didn't enabled the monitor for the sql's and its not possible in my current enveronment due to some issues with management.
    Is there any way to find out the last elapsed time for the sql with known sql_id ?

  • How to get the sql query result?

    Currently I am using LV2012 to connect a Oracle database server. After the installations/settings for Oracle Express and Oracle ODBC driver done.
    I am sucessfully to use the SQL command to query the data through my window command prompt. 
    Now the problem is, how I do the same task in Labview by using the database connectivity toolkits?
    I have build a VI for query as attached, but i have no idea what pallete to use to get the query result.
    Please help me ~~
    Go to Solution.
    Attachments: ‏9 KB

    Here is a piece of code I use to test SQL commands, you can use the part that retrieves sql results.
    It is also possible to get the column headers back, but that is for next lesson!
    Attachments: ‏30 KB

  • How to prove the SQL query will spawning the process

    In a Oracle 10g database, i noticed a user running a sql query which contain lot of "group by" "order by" iin database, suspected it spawning multiple process in database then causing the ORA-00020: maximum number of processes exceeded.
    My question is, is there any dictionary view or report that i can generate to prove that is the problematic sql causing the error?
    Please help. Many thanks.

    John Stegeman wrote:
    What makes you think that group by and order by spawn processes? In general, they don't. In fact, I cannot think of any reason they would (and if I'm wrong, I'm sure I'll be corrected forthwith)No, no correction.
    A query is a query bound to a session.
    I can only imagine that a query can spawn lots op parallel slaves when using parallel server.

  • How to get the SQL Query statement of a Search Form ?

    Hi all,
    We have a requirement to send the query result of an ADF Search Form into report application (Crystal rpt).
    Crystal can accept data source as query statement. SO I think of getting the exact query statement "generated" by the ADF Search form and send it to crystal.
    Is this possible ?
    Thank you very much,

    Try the various get methods of the viewObject such as getQuery:

  • How to check the length of a field symbol value

    hi all,
    i have a problem with string function, i have assined  table fields to  a field symbol in a loop i want check the length of the assigned fields symbol value  in every loop . i have written like ,,,,,len = strlen( <fs>). then i am getting the length of the field label what i ahve assigned to fiels symbol not the field value lenght ,
    please advise me on this,

    I think you're on the right track.  This should work:
    data: len type i.
    data: begin of itab OCCURS 1,
            a type string value '1',
            b type string value '12',
            c type string value '123',
          end of itab.
    FIELD-SYMBOLS: <fs> type ANY.
    do 3 times.
      assign component sy-index of STRUCTURE itab to <fs>.
      len = strlen( <fs> ).

  • How to change the SQL-Query in (Report in ReportViewer) by running Java App

    Ich have an App which generates dynamicly SQL-Queries. By pressing a button it should generate a report with this generated Query.
    I´m using the ReportViewer.jar. Further is it possilbe to a extra parameters form app which are not in a DB?

    <p>There are a few ways that you can achieve this. If your SQL Queries have their filters modified (ie. WHERE clause) then this can be easily solved by adding report parameters to the Report filter. Search the in-product help for "Record Filter" and you should get a number of helpful resources returned.</p><p>Additionally, you can pass in java.sql.ResultSet objects with a populated recordset of the data you want to show in the report. We don&#39;t currently provide any tools to assist the creation of the code stubs for thick-client applications (like we do for JSP pages) however you can download a collection of thick-client sample code from here:</p><p><a href=""></a> </p><p>As I mentioned, this sample contains a collection of code snippets. The one in particular you will be interested in is titled "JRCResultsetDatasource". Hopefully, this will provide you with a few options. </p><p>Regards,<br />Sean Johnson (CR4E Product Manager) </p>

  • Database slow; How to check the Oracle query timings

    I have a quick question regarding a troubleshooting iam currently working on.
    We have a J2EE application runnig on WLS 81 SP3.
    We are experiencing a problem where the customer response time on our application is "too slow". We checked our N/W and they seems to be OK. The Iplanet webserver and BEA application servers looks good but on the Oracle database box - i saw "iowait" (when doing top UNIX command) to be 50-60 % which is extremly high. We are suspecting this to be our issue as the "iowait" is very high at the DATABASE box hence causing BEA servers to show "slow response" on certain pages which are database accentric.
    Now, in order to proove that the queries are taking "too longer" to execute from the time BEA server requested and it actually got the reply back from database, i need to dig down and get some "profiling" (due to some political reasons, i can request to turn on profling at the moment) done. So, is there any way i can verify the response time when the BEA server requested some information from the database and the time when Oracle database responded with all the information requested ?
    thanks for your help,

    Yes. Create a Date object prior to the database call. Then create another one when the call completes. Convert both to mililseconds and subtract. You will have network latency in that statistic, but especially if you are using connection pools, the vast majority should be database access.
    Another option is to turn on tk_prof or create an EXPLAIN plan table in Oracle. That will show the 'cost' of each query. Also, try running statistics on the database, that should help the optimizer.
    - Saish

Maybe you are looking for