SQL Query - type mismatch

This is a post from yesterday that spiraled down the wrong track.
I have this line
s.execute("SELECT * FROM Packlists WHERE Packlist = '" + plNum + "'");
where plNum is an int. I have also tried long, short, double, etc. I always get a type mismatch error though. I have tried substituting real values for the variable. Packlist is a Long Integer field in an Access database

s.execute("SELECT * FROM Packlists WHERE Packlist = " + plNum);

Similar Messages

  • Get sql query type

    Hey all,
    I'm trying to check if the sql query is an insert or a select before executing it.
    preparedstatements doesnt give such information.
    is there a way to find the type?
    thanks

    warnerja wrote:
    jonnyd9191 wrote:
    you can do something like:
    String sql = "Some statement"
    if (sql.length() >= 6)
    String Type = sql.substring(0, 6);
    if  (Type.equalsIgnoreCase("select"))
    ResultSet resultSet = statement.executeQuery(sql);  // for select statements
    else
    statement.executeUpdate(sql); // for inserts and updates
    Hack alert!
    No good. What about calls to stored procedures which might return a resultset or not depending on their implementation? And if you accommodate them in your parsing code there, you're likely going to miss something else as well, and so forth, until eventually you've basically reinvented the SQL parsing wheel.While you are right the OP did only say "select" and "insert"

  • How to update data in third SQL query type report (M-D are first two!)

    I have page made through M-D Form wizzard.
    Third report (let's call it detail2) shows same fields as detail grid but some fields are "Standard Report column"-not editable as records in detail1 report. WHERE part in both detail reports are opposite. So together details reports show the whole set of detail records but they never show twice the same detail record (they are mutually exclusive).
    In detail2 I allow just update on one field "NAME".
    I cannot use MRU process-I think it is impossible on such a pages-at least I cannot make it work.
    So I tried different approach creating report like:
    select
      htmldb_item.hidden(3,ID) IDH,
      htmldb_item.text(4,NAZIV,78) "SADRZAJ"
    from "#OWNER#"."MYTABLE"
    where "QUESTION_ID" = :P13_ID AND "....mutual condion..."<br>Executing "for i in 1..htmldb_application.g_f04.count loop " I can retrieve values of "Naziv" field-this is not a problem!
    But it seems that "ID" from detail2 report is not easy to retrieve....Looks like that first detail is somehow involved!
    <br>I tried some things and what I get for now is following. If I execute process like:
    for i in 1..htmldb_application.g_f01.count loopI get following result (each row is record):
      2-<input type="hidden" name="f03" value="137" />
      1-<input type="hidden" name="f03" value="734" />, "1" and "2" are ordinal numbers of rows where ID's are "137" and "734". This looks promising but far away from easy referencing!
    <br>So my question is: How to retrive those values from output like shown above?? Any other hint is welcome!!
    THX!
    <br>P.S.
    <br>One straight question:
    <br>IS THERE ANY DEMO FOR MASTER-DETAIL FORM WITH THIRD REPORT ON IT??
    <br>
    <br>P.S. II
    Collection is probably not a solution because I do not want to update field on other page (like shown in Collection example on Emp table)...

    Okay, I understand now.
    Using Firefox or doing a View Source, you should be able to find out what the last fXX number is, and when coding your 3rd detail form, start like 10 digits higher, i.e., if the last fXX number is f23, I'd start with probably htmldb_item.text(35....). This approach should work, but I have never tried it.
    To me, the basic functionality from the M-D wizard is nice, but adding a third report complicates things enough that I'd probably manually code both the 2nd and 3rd reports. would mean more work with the validations and processes, but I think for this situation it would be more flexible, allowing you greater control. For your manually created detail reports (I'd do both manually), I would skip some numbers between the first and second reports, i.e. first detail report uses htmldb_item.xxxx(1......) through htmldb_item.xxxx(9.....) and then I would start the next detail report as htmldb_itemxxxx.(20....).
    Regarding your example, to 'retrieve' the values of the ID column (htmldb_item.hidden(3,ID)), you should be able to get it through the loop process you described above, htmldb_application.g_f03(i).
    Like:
    for i in 1..htmldb_application.g_f02.count
    loop
    if htmldb_application.g_f03(i) is not null AND htmldb_application.g_f04(i) is not null then
    -- do whatever processing you want to do, insert, updates, etc.
    end if;
    end loop;
    Whatever number you use in the htmldb_item specification is also how yuo refer to it in htmldb_application:
    htmldb_item.XXXX(1....) = htmldb_application.g_f01
    htmldb_item.XXXX(3....) = htmldb_application.g_f03
    etc.
    Use the looping mechanism to (I used (i) in my example above) to go through each row and retrieve that row's value.
    Sorry if any of the above is already familar to you. Judging by what posts I remember of your's, it seems that some of this you already know, but I guess it's better than assuming you do and leaving some stuff out that you didn't know.
    Hope this helps.
    Bill Ferguson

  • SQL Query (pl/sql function body returning Sql query)

    Hi All,
    I have created a region of "SQL Query (pl/sql function body returning Sql query)" type and it is working fine , but when I am migrating(export /import) this application from development to systest environment ,
    It gives error for this region :
    Error ERR-1101 Unable to process function body returning query.
    OK
    ORA-06550: line 1, column 52: PLS-00306: wrong number or types of arguments in call to 'FU_TRADE_REPORT_QUERY' ORA-06550: line 1, column 45: PL/SQL: Statement ignored
    Any pointer ...why this is happening.
    Thanks
    Dikshit

    If your function is a stored function that is called from within APEX (function body not coded into the app itself), have you made sure that the function has been created and compiles ok prior to installing your apex app.
    If there are some dependency issues between other PL/SQL units or database objects that are causing your function not to be compiled, you apex install will fail as you are trying to reference an uncompelled bit of pl/sql.
    Let me know how you get on
    Regards
    Duncan

  • SQL Insert Statement Data Type Mismatch Error

    I am doing a very simple web application that has a Microsoft Access database as the data source. I have been able to sucessfully create update and query statements using parameters but am having issues with an insert statement. I am using JSTL 1.1.2
    The following code creates the data type mismatch error.
    <sql:update
         sql="insert into tblTtoF(TFToolID,TFFeatID) values(?,?)">
            <sql:param value='$(ID}'/>
         <sql:param value='${feature}'/>
            </sql:update>The table has NUMBER as the data type for both of these fields and the variables I am feeding into it are both numbers. If I hard code the first number into the sql statement then it works. I have tried swapping the variables around and as long as the first one is hard coded the parameter for the second one works no matter which is first or second.
    However I can get the following code to work, which of course leaves me vulnerable to sql injection attacks which is not really a good thing.
    <sql:update>
         insert into tblTtoF(TFToolID,TFFeatID) values('<c:out value="${ID}"/>','<c:out value="${feature}"/>')
            </sql:update>So I am just looking for any suggestions as to why my first piece of code doesn't work seeing as it is the simplest of SQL statements and the most standard syntax.
    Thanks

    I changed it to the following
         <c:set var="featurenew" value="${0 + feature}"/>
         <c:set var="IDnew" value="${0 + param.toolID}"/>
              <sql:update
              sql="insert into tblTtoF(TFToolID,TFFeatID) values(?,?)">
              <sql:param value='$(IDnew}'/>
              <sql:param value='${featurenew}'/>
              </sql:update>And got the following error in the localhost.log
    31/07/2006 09:31:41 org.apache.catalina.core.StandardWrapperValve invoke
    SEVERE: Servlet.service() for servlet jsp threw exception
    java.sql.SQLException: SQL Exception : [Microsoft][ODBC Microsoft Access Driver]Optional feature not implemented
         at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setObject(JdbcOdbcPreparedStatement.java:1437)
         at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setObject(JdbcOdbcPreparedStatement.java:1072)
         at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setObject(JdbcOdbcPreparedStatement.java:1063)
         at org.apache.taglibs.standard.tag.common.sql.UpdateTagSupport.setParameters(UpdateTagSupport.java:254)
         at org.apache.taglibs.standard.tag.common.sql.UpdateTagSupport.doEndTag(UpdateTagSupport.java:156)
         at org.apache.jsp.dataUpdated_jsp._jspx_meth_sql_update_1(dataUpdated_jsp.java:975)
         at org.apache.jsp.dataUpdated_jsp._jspx_meth_c_if_0(dataUpdated_jsp.java:879)
         at org.apache.jsp.dataUpdated_jsp._jspx_meth_c_forEach_0(dataUpdated_jsp.java:680)
         at org.apache.jsp.dataUpdated_jsp._jspService(dataUpdated_jsp.java:151)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:833)
         at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:639)
         at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1285)
         at java.lang.Thread.run(Thread.java:595)
    I have also tried the following in the past with no luck
    <fmt:parseNumber value="${ID}" type="number" var="IDnew"/>
    AND......
    <sql:query
       sql="select TFToolID from tblTtoF where TFToolID = ?"
       var="toolresults">
       <sql:param value="${ID}"/>
    </sql:query>
    <c:forEach var="getID" items="${toolresults.rows}">
         <c:set var="theID" value="${getID.TFToolID}"/>
    </c:forEach>
    AND when that didn't work, added this....
    <fmt:parseNumber value="${theID}" var="IDnew"/>

  • ORA-19279: Query dynamic type mismatch: expected singleton sequence

    Hi,
    I have my xml stored in the table 'xml_table’
    The content of XML is a follows:
    <COMPANY NAME="ABC">
    <DEPARTMENT_NAME>Paris</DEPARTMENT_NAME>
    <ADDRESS>Rue de nevers</ADDRESS>
    <DEPARTMENT_NAME>London</DEPARTMENT_NAME>
    <ADDRESS>Northampton Square</ADDRESS>
    </COMPANY>
    I would like to query the xml to get the output like that:
    COMPANY_NAME | DEPARTMENT_NAME | ADDRESS
    ABC | Paris | rue de nevers
    ABC | London | Northampton Square
    However when I execute the query:
    SELECT t.company_name, t.address, t.department_name
    FROM xml_table p,
    XMLTable('/COMPANY' PASSING p.OBJECT_VALUE
    COLUMNS company_name PATH '@NAME',
    address VARCHAR2(100) PATH '/COMPANY/ADDRESS',
    department_name VARCHAR2(100) PATH '/COMPANY/DEPARTMENT_NAME') t
    I am getting error:
    ORA-19279: XPTY0004 - XQuery dynamic type mismatch: expected singleton sequence - got multi-item sequence
    What can be wrong with the query? Howe should it be modified to get desired output?
    Thank for help
    Groxy

    As was mentioned... Enclosing the tags for each department in a DEPARTMENT tag would make this easier and more effiecient but here's an alternative approach if modifying the XML is not an option
    SQL> with COMPANY_XML as
      2  (
      3    select XMLTYPE(
      4  '<COMPANY NAME="ABC">
      5     <DEPARTMENT_NAME>Paris</DEPARTMENT_NAME>
      6     <ADDRESS>Rue de nevers</ADDRESS>
      7     <DEPARTMENT_NAME>London</DEPARTMENT_NAME>
      8     <ADDRESS>Northampton Square</ADDRESS>
      9  </COMPANY>') as OBJECT_VALUE from dual
    10  )
    11  select R.*
    12    from COMPANY_XML,
    13         XMLTABLE
    14         (
    15            'for $COMP in $COMPANY/COMPANY
    16               for $DEPT at $DEPTIDX in $COMP/DEPARTMENT_NAME
    17                 return <RESULT>
    18                         <NAME>{fn:data($COMP/@NAME)}</NAME>
    19                         {
    20                           $COMP/DEPARTMENT_NAME[$DEPTIDX],
    21                           $COMP/ADDRESS[$DEPTIDX]
    22                         }
    23                       </RESULT>'
    24            passing OBJECT_VALUE as "COMPANY"
    25        ) r
    26  /
    COLUMN_VALUE
    <RESULT><NAME>ABC</NAME><DEPARTMENT_NAME>Paris</DEPARTMENT_NAME><ADDRESS>Rue de
    nevers</ADDRESS></RESULT>
    <RESULT><NAME>ABC</NAME><DEPARTMENT_NAME>London</DEPARTMENT_NAME><ADDRESS>Northa
    mpton Square</ADDRESS></RESULT>This above step creates a document for all tags with a particular index and then we can apply a columns cause to get the results..
    SQL>   with COMPANY_XML as
      2  (
      3    select XMLTYPE(
      4  '<COMPANY NAME="ABC">
      5     <DEPARTMENT_NAME>Paris</DEPARTMENT_NAME>
      6     <ADDRESS>Rue de nevers</ADDRESS>
      7     <DEPARTMENT_NAME>London</DEPARTMENT_NAME>
      8     <ADDRESS>Northampton Square</ADDRESS>
      9  </COMPANY>') as OBJECT_VALUE from dual
    10  )
    11  select R.*
    12    from COMPANY_XML,
    13         XMLTABLE
    14         (
    15            'for $COMP in $COMPANY/COMPANY
    16               for $DEPT at $DEPTIDX in $COMP/DEPARTMENT_NAME
    17                 return <RESULT>
    18                         <NAME>{fn:data($COMP/@NAME)}</NAME>
    19                         {
    20                           $COMP/DEPARTMENT_NAME[$DEPTIDX],
    21                           $COMP/ADDRESS[$DEPTIDX]
    22                         }
    23                       </RESULT>'
    24            passing OBJECT_VALUE as "COMPANY"
    25            columns
    26            NAME            VARCHAR(10),
    27            DEPARTMENT_NAME VARCHAR2(24),
    28            ADDRESS         VARCHAR2(24)
    29        ) r
    30  /
    NAME       DEPARTMENT_NAME          ADDRESS
    ABC        Paris                    Rue de nevers
    ABC        London                   Northampton Square
    SQL>

  • Error in SQL Query The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator. for the query

    hi Experts,
    while running SQL Query i am getting an error as
    The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator. for the query
    select  T1. Dscription,T1.docEntry,T1.Quantity,T1.Price ,
    T2.LineText
    from OQUT T0  INNER JOIN QUT1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN
    QUT10 T2 ON T1.DocEntry = T2.DocEntry where T1.DocEntry='590'
    group by  T1. Dscription,T1.docEntry,T1.Quantity,T1.Price
    ,T2.LineText
    how to resolve the issue

    Dear Meghanath,
    Please use the following query, Hope your purpose will serve.
    select  T1. Dscription,T1.docEntry,T1.Quantity,T1.Price ,
    CAST(T2.LineText as nvarchar (MAX))[LineText]
    from OQUT T0  INNER JOIN QUT1 T1 ON T0.DocEntry = T1.DocEntry LEFT OUTER JOIN
    QUT10 T2 ON T1.DocEntry = T2.DocEntry --where T1.DocEntry='590'
    group by  T1. Dscription,T1.docEntry,T1.Quantity,T1.Price
    ,CAST(T2.LineText as nvarchar (MAX))
    Regards,
    Amit

  • Possible Bug? SQL query changing the Cursor Type from Scrollable to non Scrollable in a ResultSet

    Hi all,
    I've been beating my head against this for a few days now, and while
    there is a workaround, I haven't found out what's causing this to
    happen.
    Every other SQL query except for this one particular query works fine
    and returns a scrollable result set. That one query on the other hand,
    returns a non-scrollable result set.
    Here's the code which is calling the query:
    sqlStatement = getSQLFromFile();
    debug("SQL statment = " + sqlStatement);
    stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
    debug(sqlStatement);
    rst = stmt.executeQuery(sqlStatement);
    debug("The type is " + rst.getType());
    rst.last();
    For most queries, the output is "The type is 1004" - which means the
    resultset is scrollable - as it should be.
    For one particular query, the output is "The type is 1003" which means
    that the result set is of type forward-only.
    Of course, calling rst.last() fails in the second case.
    If the difference between the queries was drastic, I might have
    something to go on. I've tested this out with different size queries,
    but the switch between having the type incorrectly changed is the
    deletion of a 0x0a 0x0d on the first line.
    I.E. this means the failing query reads :
    "select
    from........."
    and the query which works reads
    "select *
    from........."
    I've looked at the failing query in it's binary format, and that's the
    only difference I can discern.
    To further confuse things, there are other queries which have a
    similar format - and which work.
    I've read about a bug in Weblogic 5.1 SP9 which ignores the setting of
    the Statement to return a ResultSet with a scrollable cursor, and
    while this seems to be a bug, it doesn't seem the same bug at all -
    besides, I'm using Weblogic 6.0 with SP1 on a W2K system.
    Does anyone have any ideas as to what might be causing this? I'm
    stumped..

    Ryan D'Silva wrote:
    Hi Joe,
    I'm using the Oracle thin driver -
    oracle.jdbc.driver.OracleDriver - version #8.1.6.0.0
    and the DBMS is
    "Oracle9i Enterprise Edition Release 9.2.0.2.0 - Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.2.0 - Production"
    Does that help?Yes. Two things: TYou should probably upgrade the oracle thin
    driver, by downloading the latest appropriate one from their site,
    and make sure it's ahead of all weblogic jars in the classpath the
    server builds for itself. Also, let's see how simple we can make the
    problem. Would you please repeat the JDBC that demonstrated the problem,
    in a small standalone java program that uses a direct thin driver connection,
    getting weblogic out of the picture? (The problem does sound like
    and oracle driver issue).
    Joe
    >
    >
    Thanks,
    - ryan
    You don't say what DBMS and what JDBC driver you're using for the pool.
    That is likely to be the issue. Let me know.
    Joe
    Here's the code which is calling the query:
    sqlStatement = getSQLFromFile();
    debug("SQL statment = " + sqlStatement);
    stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
    debug(sqlStatement);
    rst = stmt.executeQuery(sqlStatement);
    debug("The type is " + rst.getType());
    rst.last();
    For most queries, the output is "The type is 1004" - which means the
    resultset is scrollable - as it should be.
    For one particular query, the output is "The type is 1003" which means
    that the result set is of type forward-only.
    Of course, calling rst.last() fails in the second case.
    If the difference between the queries was drastic, I might have
    something to go on. I've tested this out with different size queries,
    but the switch between having the type incorrectly changed is the
    deletion of a 0x0a 0x0d on the first line.
    I.E. this means the failing query reads :
    "select
    from........."
    and the query which works reads
    "select *
    from........."
    I've looked at the failing query in it's binary format, and that's the
    only difference I can discern.
    To further confuse things, there are other queries which have a
    similar format - and which work.
    I've read about a bug in Weblogic 5.1 SP9 which ignores the setting of
    the Statement to return a ResultSet with a scrollable cursor, and
    while this seems to be a bug, it doesn't seem the same bug at all -
    besides, I'm using Weblogic 6.0 with SP1 on a W2K system.
    Does anyone have any ideas as to what might be causing this? I'm
    stumped..

  • SQL Query for members of dynamic group - Need to include Name, Path and Type

    Hello,
    I built a custom dynamic group that has all my SQL databases in it using SCOM 2012 SP1.  The group works fine as I can see the Name(ie, Database name), Health State, Path (ie, hostname/instance) and Types (ie; SQL 2005).  Now I'm trying to
    build a custom report based off this same information using a SQL query.   I'm no DBA and could use some help.  So far this is what i have
    use
    select
    SourceObjectDisplayName as
    'Group Name',
    TargetObjectDisplayName,TargetObjectPath
    from RelationshipGenericView
    where isDeleted=0
    AND SourceObjectDisplayName
    like
    'SQL_Databases_All'
    ORDERBY TargetObjectDisplayName
    This gets me the Group Name (which i really don't care about), database name, and hostname/instance. What I am missing is the Health State and most importantly the Type (ie, SQL Server 2005 DB, SQL Server 2008DB).
    If someone could assist me here I would appreciate it. I believe I need to do some type of INNER JOIN but have no idea where the SQL type info lives or the proper structure to use. Thanks
    OperationsManager

    Here's the updated Query for OpsMan 2012 R2:
    To find all members of a given group (change the group name below):
    select SourceObjectDisplayName as 'Group Name', TargetObjectDisplayName as 'Group Members' 
    from RelationshipGenericView 
    where isDeleted=0 
    AND SourceObjectDisplayName = 'Agent Managed Computer
    Group' 
    ORDER BY TargetObjectDisplayName

  • Type: SQL Query (updateable report)

    Hello,
    Is it possible to default a field value in a SQL Query (updateable report) Report Region in a DML Form when the 'Add Row' button is clicked? I want to default some List of Value fields. This is not as simple as a HTML Region Item based on a table, there is a 'Default' tab where the field value goes. Any help is appreciated, thanks.

    Hi,
    On the tabular form's Column Attributes tab, select the column. You should see a section headed "Tabular Form Element". In there, there are two settings you can use: Default Type and Default
    Andy

  • SQL Query using DATS data type

    Hello people,
    I have a table 'TableA' with a column 'xpto' that has DATS data type.
    A lot of lines in this table has this field empty.
    I have to create a SQL query to select those lines with this field not empty.
    Select * from TableA
    where xpto is not null
    It does not work.... The result is all the lines in the table.
    What is wrong?
    Thanks!

    Easiest way to do this is :
    constants l_xpto   type tableA-xpto  value is initial
    Select * from TableA
    where xpto ne l_xpto.
    You can see the NULL/NOT NULL settings for the column through SE11
    Utilities -> Database Object -> Display.
    I tend to set the "Initial Value" flag when adding columns to tables, which creates the database column as NOT NULL with a default value (whatever SAP considers the initial value for that datatype). I think SAP does this by default, but I've had issues where it hasn't so I do this to ensure consistency
    Chris Bain

  • Validation of a Region defined as type SQL QUERY (Updateable Report)

    Hi,
    I am trying to perform some validation on a Region defined as type SQL QUERY (Updateable Report). The report has two columns.
    One of the columns is a Select List and I would like to insure that a user cannot select the same value twice
    in the report. For example, if the select list has 5 values, A, B, C, D, E, I don't want a user to be able to select
    B twice in the report. I am assuming that I will need to incorporate javascript
    into my validation logic in order to perform this task. If so, could someone provide some guidance? Or are there
    other alternatives.
    Thanks in advance,
    Michael

    Dan,
    Sorry, I didn't mean to post the question twice. I was trying to edit my original question. Thanks for the link to the website. I am new to APEX development so the website you gave me will be extremely useful to learn new development techniques.
    Thanks again,
    Michael

  • SQL query returns varchar - default value type!!!

    On a field in my portal form there is a default value type of 'SQL query returns varchar', where can I put this sql to get a default value from a table?

    Hi again
    I have this code in 'additional pl/sql code' - '...before displaying the page'. But it comes up with an error when I run the form.
    declare
    prop_v varchar2(20);
    group_v varchar2(3);
    el1_v varchar2(3);
    blk varchar2(10) := 'DEFAULT';
    begin
    prop_v := p_session.get_value_as_varchar2(p_block_name=>'DEFAULT', p_attribute_name => 'l_property_p');
    group_v := p_session.get_value_as_varchar2(p_block_name=>'DEFAULT', p_attribute_name => 'l_group_p');
    select element_code
    into el1_v
    from eh_risk_element_detail
    where property_ref = prop_v
    and group_code = group_v
    and line_no = 1;
    p_session.set_value(p_block_name => blk, p_attribute_name => 'L_ELEMENT1_P', p_value => el1_v);
    end;
    Rich

  • Need to return CLOB as String type from SQL query

    I have a table that contains a CLOB column, which should be accessible to a JDBC client (JReports) that does not understand how to extract CLOB from a result set.
    A possible workaround would be to translate the CLOB type into a normal string on the database side as part of the SQL query (or a view), so that the client can handle it. For that to work, we would need a type conversion within the query itself.
    Rather then
    SELECT clob_column FROM my_table
    we would need something like
    SELECT to_char(clob_column) FROM my table
    Unfortunately to_char does not work, but possibly there are other ways to achieve it.
    null

    Hi Christo
    Works fine. Just had to change the parameter order:
    DBMS_LOB.substr(clob_column,4000,1) converts the CLOB to a VARCHAR
    Thanks a lot,
    Thomas
    null

  • How to pass parameter value as "where [fieldname] = [fieldvalue]" in sql query under query type in SSRS report?

    I am having trouble with passing dynamic string to sql query for executing SSRS reports.
    I am using oracle database and I want to pass where clause parameter as "where LAND_NR = 6" to my select query.
    For example: I want to execute Select * from employee :p_where.
    where p_where parameter holds value "where LAND_NR = 6"
    So it will treat as "Select * from employee where LAND_NR = 6" statement which will give me the list of records to display in my reports.
    But it's not taking correct sql command throwing an error as "SQLcommand not properly ended."
    How can I achieve this?

    You need to use dynamic sql
    But please keep in mind that since you're using Oracle you may be better off posting this in some Oracle forums
    This forum is specifically for SQL Server
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

Maybe you are looking for

  • Safari doesn't open.....(Must be On Safari..)

    Ok, this Safari is useless! It has crashed my OSX 10.4, resorting me to re-install/archive my entire system. I'm now at 10.3 and it seems ok. Anyways, back to Safari...Now it does the bouncing ball of death dance and goes nowhere fast. I think it has

  • ITunes and Quicktime downgrading...

    Hi there... I have a G4 and am using OSX 10.3.9. This is my Pro-Tools computer as I have an older version of ProTools that doesn't run on 10.4 or upwards. So... The story so far. I updated my computer with the more recent versions of iTunes and Quick

  • I find it annoying that you can't use aliases in where statements

    I find it annoying that you can't use aliases in where statements for example: SELECT TOP 1 CAST(amount / ( CASE WHEN ISNULL(rate, 0) <> 0 THEN rate ELSE 1 END ) AS NUMERIC(10, 2)) AS num FROM table WHERE num > 1 ORDER BY num Are there any workaround

  • EM was stopped.

    On 2 of my oracle database server, em is stopped. I do remember I have to restart the database once since the server was shutdown. but do I need to restart em when restart my database? If I donot, why em is down. I had to restart it in unix using emc

  • Unable to save or open files in Excel from Office 2011 on my Mac Air with Mountain Lion?

    Excel 2011 no longer saves or opens files?