Sql is too long for DBMS_SQL.EXECUTE()

The code as the following works. However if I run it with my original SQL statement(in quotes), this procedure does not have results shown. How to solve the problem?
create or replace procedure dynamic_sql(p_fail IN tab.DisFai1_1%type) IS
v_counter NUMBER;
v_sqlClause varchar2(1000);
v_cursorID INTEGER;
v_return_rows INTEGER;
v_c number;
BEGIN
v_cursorID := DBMS_SQL.OPEN_CURSOR;
FOR i IN 1..17 LOOP
/* v_sqlClause := 'BEGIN select count(*) from tab where DISFAI'||i||'_1 LIKE :f OR DISFAI'||i||'_2 LIKE :f OR DISFAI'||i||'_3 LIKE :f OR DISFAI'||i||'_4 LIKE :f OR DISFAI'||i||'_5 LIKE :f OR DISFAI'||i||'_6 LIKE :f OR DISFAI'||i||'_7 LIKE :f OR DISFAI'||i||'_8 LIKE :f OR DISFAI'||i||'_9 LIKE :f;END;';*/
v_sqlClause := 'BEGIN select count(*) INTO :counter from bhu where DISFAI'||i||'_1 LIKE :f;END;';
DBMS_OUTPUT.PUT_LINE('SQL= '||v_sqlClause);
DBMS_SQL.PARSE(v_cursorID, v_sqlClause, DBMS_SQL.V7);
dbms_sql.bind_variable(v_cursorID, ':f', p_fail );
dbms_sql.bind_variable(v_cursorID, ':counter', v_counter );
v_return_rows := DBMS_SQL.EXECUTE(v_cursorID);
dbms_sql.variable_value(v_cursorID, ':counter', v_counter );
DBMS_OUTPUT.PUT_LINE('there are '||v_counter||' rows.');
END LOOP;
dbms_sql.close_cursor(v_cursorID);
EXCEPTION
WHEN OTHERS THEN
DBMS_SQL.CLOSE_CURSOR(v_cursorID);
END;

Christian was referring to EXECUTE IMMEDIATE
declare
   sql_stmt    VARCHAR2(200);
   v_count     PLS_INTEGER;
   v_deptno    PLS_INTEGER := 20;
begin
   sql_stmt := 'SELECT count(*) FROM emp WHERE deptno = :id';
   EXECUTE IMMEDIATE sql_stmt INTO v_count USING v_deptno;
   dbms_output.put_line(v_count);
end;
/For more information see PL/SQL User's Guide and Reference Chapter 10
http://download-west.oracle.com/docs/cd/A87860_01/doc/appdev.817/a77069/10_dynam.htm#4376

Similar Messages

  • Java.sql.SQLException:ORA-01801:date format is too long for internal buffer

    Hi,
    I am getting the following exception when i trying to insert data in to a table through a stored procedure.
    oracle.apps.fnd.framework.OAException: java.sql.SQLException: ORA-01801: date format is too long for internal buffer
    when execute this stored procedure from ana anonymous block , it gets executed successfully, but i use a OracleCallableStatement to execute the procedure i am getting this error.
    Please let me know how to resolve this error.
    Is this error something to do with the Database Configuration ?
    Thanks & Regards
    Meenal

    I don't know if this will help, but we were getting this error in several of the standard OA framework pages and after much pain and aggravation it was determined that visiting the Sourcing Home Page was changing the timezone. For most pages this just changed the timezone that dates were displayed in, but some had this ORA-01801 error and some others had an ORA-01830 error (date format picture ends before converting entire input string). Unfortunately, if you are not using Sourcing at your site, this probably won't help, but if you are, have a look at patch # 4519817.
    Note that to get the same error, try the following query (I got this error in 9.2.0.5 and 10.1.0.3):
    select to_date('10-Mar-2006', 'DD-Mon-YYYY________________________________________________HH24:MI:SS') from dual;
    It appears that you can't have a date format that is longer than 68 characters.

  • ORA-09100 specified length too long for its datatype with Usage Tracking.

    Hello Everyone,
    I'm getting an (ORA-09100 specified length too long for its datatype) (a sample error is provided below) when viewing the "Long-Running Queries" from the default Usage Tracking Dashboard. I've isolated the problem to the logical column "Logical SQL" corresponding to the physical column "QUERY_TEXT" in the table S_NQ_ACCT. Everything else is working correctly. The logical column "Logical SQL" is configured as a VARCHAR of length 1024 and the physical column "QUERY_TEXT" is configured as a VARCHAR2 of length 1024 bytes in an Oracle 11g database. Both are the default configurations and were not changed.
    In the the table S_NQ_ACCT we do have record entries in the field "QUERY_TEXT" that are of length 1024 characters. I've tried various configuration such as increasing the the number of bytes or removing any special character but without any sucess. Currently, my only possible workaround is reducing the "Query_Text" data entries to roughly 700 characters. This makes the error go away. Additional point my character set to WE8ISO8859P15.
    - Any suggestions?
    - Has anyone else ever had this problem?
    - Is this potentially an issue with the ODBC drive? If so, why would ODBC not truncate the field length?
    - What is the maximum length supported by BI, ODBC?
    Thanks in advance for everyones help.
    Regards,
    FBELL
    *******************************Error Message**************************************************
    View Display Error
    Odbc driver returned an error (SQLExecDirectW).
    Error Details
    Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 17001] Oracle Error code: 910, message: ORA-00910: specified length too long for its datatype at OCI call OCIStmtExecute: select distinct T38187.QUERY_TEXT as c1 from S_NQ_ACCT T38187 order by c1. [nQSError: 17011] SQL statement execution failed. (HY000)
    SQL Issued: SELECT Topic."Logical SQL" saw_0 FROM "Usage Tracking" ORDER BY saw_0
    *******************************************************************************************

    I beleieve I have found the issue for at least one report.
    We have views in our production environment that call materialized views on another database via db link. They are generated nightly to reduce load for day-old reporting purposes on the Production server.
    I have found that the report in question uses a view with PRODUCT_DESCRIPTION. In the remote database, this is a VARCHAR2(1995 Bytes) column. However, when we create a view in our Production environment that simply calls this materialized view, it moves the length to VARCHAR2(4000).
    The oddest thing is that the longest string stored in the MV for that column is 71 characters long.
    I may be missing something here.... But the view that Discoverer created on the APPS side also has a column length for the PRODUCT_DESCRIPTION column of VARCHAR2(4000) and running the report manually returns results less than that - is this a possible bug?

  • Performance issues; waited too long for a row cache enqueue lock!

    hi Experts,
    OS: Oracle Solaris on SPARC (64-bit)
    DB version:
    SQL> select * from V$VERSION;
    BANNER
    Oracle Database 11g Release 11.2.0.1.0 - 64bit Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE    11.2.0.1.0      Production
    TNS for Solaris: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    SQL>We have seen 100% CPU usage and high database load, so I checked the instance and have seen there were many blocking sessions and more than 71 sessions running the same select ;
    elect tablespace_name as tbsname from        (select tablespace_name,sum(bytes)/1024/1024 free_mb,0 total_mb,0 max_mb         from dba_free_space         group by tablespace_name         union         select tablespace_name, 0 current_mb,sum(bytes)/1024/1024 total_mb,                sum(decode(maxbytes, 0, bytes, maxbytes))/1024/1024 max_mb         from dba_data_files         group by tablespace_name) group by tablespace_name having round((sum(total_mb)-sum(free_mb))/sum(max_mb)*100) > 95  Blocking sessions are running queries like this;
    SELECT * from MYTABLE WHERE MYCOL=:1 FOR UPDATE;This select queries are coming from a cron job running every 10 minutes to check the tablespaces; so I first killed (kill -9 pid) those select statements so the load and CPU decreased to 13% of CPU usage. Blocking sessions still there and I didn't killed them waiting for app guys confirmation... after few hours and the CPU usage never went down the 13%; I have seen many errors;
    WAITED TOO LONG FOR A ROW CACHE ENQUEUE LOCK! pid=...System State dumped to trace file .....trcAfter that , we decided to restart the DB to release the locks!
    I would like to understand why during loads we were no able to run those select statements, statspack schedule snapshot reports were not able to finish, also automatic
    database statistics... why 5 for update statements locked the whole DB?

    user12035575 wrote:
    SELECT FOR UPDATE will only lock the table row until the transaction is completed.
    "WAITED TOO LONG FOR A ROW CACHE ENQUEUE LOCK" happens when it needs to acquire a lock on data dictionary. Did you check the trace file associated with the statement?The trace file is too long, which information I need to focus more?

  • Unable to evaluate workflow rule - Value too long for field

    Need help with a workflow error for a record update before the record is saved. There are 3 calculations that would be done in a particular order - all on number fields. Each time, I am overwriting existing values. The individual numbers could have up to 6 decimal spaces. When I try to update one or more fields that contain the calculation, I get an error message saying that the system is unable to evaluate the workflow rule - value too long for field (zNum6).
    This same calculation is fine when a new record is entered and the calculation is done as a default field value.
    Any ideas?

    I actually had to use a ToChar function at the beginning of the calculation and #### to indicate the number of digits to make this work. Oracle Help Desk provided the answer - quickly.

  • String literal too long for CLOB

    Q1. I would like to insert text of 10000 chars into a column with data type CLOB via an ASP program connecting to Oracle9i. Which data type is most appropriate to input 10000 chars into a column?
    Q2. I would like to insert text UNICODE Traditional Chinese into a column with data type NCLOB, data is stored but when it is retrieved via Internet Explorer, strang chars are displayed instead of Traditional Chinese. Can any one tell me how you could store Chinese Chars, retrieve and display Chinese Chars properly in Internet Exlplorer via ASP program?

    10,000 characters is too long for a varchar2 column, but CLOB's will let you store a couple of Gb.
    When you're dealing with inserting and retrieving Traditional Chinese characters, you need to ensure that the NLS settings on your client and on your database are such that the character sets on both machines actually support the characters in question. I'm guessing that your client machine isn't configured to support those characters. If you go to http://tahiti.oracle.com and search for NLS, you'll get a boat-load of documents about how to approach this sort of problem If you haven't reviewed these yet, I'd strongly suggest doing so.
    Justin

  • FRM-40831 : Truncation occured: value too long for filed MAST_EMP_NAME

    Hi
    I'm using Forms 5 and getting following error.
    FRM-40831 : Truncation occured: value too long for filed MAST_EMP_NAME.
    When i checked in the column Mast_emp_name, all the values are with in the limit.
    Table contains some 9 lacs record.
    Please help me. this is very urgent

    check the maximum length - property of all those 5 columns in your form. They have to be as long as in the database. Except number. They have to be 1 char longer than in the db.
    Forms-Online-Help says:
    This property can potentially limit the amount of data that an item is allowed to contain internally (in the Forms server) when it's in native format. It can also potentially limit the number of character (or bytes) displayed or entered by the end user. That is, it can specify a data limit and/or a user interface (UI) limit. The exact effect depends upon several factors, including the item's Data type, Data Length Semantics, and Format Mask properties. For a character item (datatypes CHAR, ALPHA, LONG), the Maximum Length property specifies a data limit. The property value specifies either the maximum number of bytes or else the maximum number of characters, depending upon the value of the Data Length Semantics property. Within a group of character mirror items, the Maximum Length property is always taken from the master mirror item. A compiler (generator) warning is issued if a non-zero non-default value is specified in a subordinate mirror item. If a character item has no format mask (the Format Mask property is null), then the Maximum Length property (taken from the master mirror item) also specifies a UI limit. When the Forms server is using the UTF8 character set , this UI limit has the same semantics (byte versus character) as the data limit. When the Forms server is using a multi-byte character set other than UTF8, and the Data Length Semantics property specifies byte semantics, Forms cannot prevent the end user from typing in too many bytes. Instead, it uses character semantics for the UI limit. In such a case, the end user is allowed to type in too many bytes. When the end user attempts to navigate out of the current validation unit, one of two things will happen. If the application property FLAG_USER_VALUE_TOO_LONG is set, an error will be flagged and the excess characters on the right will be selected. If this application property is not set, the excess characters will be quietly truncated, and the navigation will succeed. If a character item has a format mask, then the item's UI limit is derived from the format mask. This limit is always a character limit. For a number item (datatypes NUMBER, INT, MONEY, RNUMBER, RINT, RMONEY), the Maximum Length property specifies a user interface limit. This limit is always a character limit. There is no data limit. The data item can always internally hold up to 23 bytes (which is the maximum size of an Oracle number in native format), regardless of the value of the Maximum Length property. For a date or time item (datatypes DATETIME, DATE, TIME, JDATE, EDATE), the Maximum Length property specified in Forms Builder has almost no effect (See the Query Length property for a discussion of the only effect). As with "number" items, there is no data limit. For DATE and DATETIME items, the internal value is 7 bytes long, and for TIME, JDATE and EDATE items, the internal value is 4 bytes long . The user interface limit is derived from the format mask. This limit is always a character limit which is what is returned by GET_ITEM_PROPERTY(item, MAX_LENGTH).

  • FRM-40831: Value too long for field ROWID.

    Hi,
    I'm a newbie in forms and I've a problem when working with index organized tables, it post me this error:
    FRM-40831: Truncation occurred : Value too long for field ROWID.
    How can I solve this problem?
    Thanks for your help.
    Raúl

    This is a bug in Forms 9i (bug 2408210). The workaround is to:
    - change block property Key Mode to Updatable or Non-Updatable
    - set item property Promary Key to Yes for all items that correspond to an index column in the index-organized table

  • Error: WAITED TOO LONG FOR A ROW CACHE ENQUEUE LOCK! pid=26

    Hi every one,
    Today, i met a problem: Application cannot connect to database because database hang ( I also cannot connect to database with sqlplus) . Check alert log, only one error:
    WAITED TOO LONG FOR A ROW CACHE ENQUEUE LOCK! pid=26This error not only appear first time, but also happen every one month. I must reset server for database release all memory but I think It isn't a true solution!
    Could you give a recommend for this.
    Regards.

    The Row Cache is actually the Data Dictionary Cache. It is where definitions from the data dictionary (tablespaces, objects, users etc) are loaded into memory.
    There would be an associated trace file written with the occurrence of this warning.
    See Oracle Support Note 278316.1 for more information
    Hemant K Chitale

  • Hello I just made a playlist and it was too long for  cdd so I burned it to a dvd. When I went to check it the oreder of the songs was totally changed. Is this something I can fix?

    Hello I just made a playlist and it was too long for a CD so I burned it to a DVD. When I went to check it the song order was totally changed, is this something I can fix?

    Thank you SO much.  Sorry.  I am flustered and didn't even notice.  LOL
    Have a good night.  I have posted my question in the correct forum now.  Thanks for your help.

  • JDBC THEME-MAPVIEWER-05517 Request string is too long for Oracle Maps' non-

    hi,
    if I need a quite complex query to be added to dynamic JDBC theme I get this error:
    [MAPVIEWER-05517] Request string is too long for Oracle Maps' non-AJAX remoting.
    -why? I am using Oracle Maps JS API so it is AJAX remoting, or not?
    -what is the limit of a JDBC theme definition?
    regards,
    Brano

    hi,
    yes, having look at MVMapView.enableXMLHTTP(true) in doc explains a lot...
    thanks,
    Brano

  • When I take a video with my iPad, why isn't sharing with Facebook an option? Also if I take a video that is 1 min 23 sec, how is that too long for an email?

    Why is 1min 23 second video too long for email?

    How recently did you switch?  If it's less than 60 days, then Verizon simply reinstates your previous account.  The fact that you were on the EDGE plan and mailed the devices back, and they apparently are somewhere in the system, could cause complications, and it might just work out that you just go back on the same plan and they set you up with the same devices.  I'm not sure how it will go - but since you are still being billed for the devices... 

  • General Delivery, Too Long for Delivery

    Hi There,
    I reckon that the delivery of the iPhone 6 plus for 3week to 4week, It's about one month, This is too long for your customers.
    I believe that Apple can do better than that...And hope that next new product, Apple will make better delivery might be 2week to 3Week that include with shipping period for 3Week the most..
    Your Apple supporter,
    Berst regards,
    Samath Lim

    You're not telling Apple anything here.  It's a user-to-user tech support forum.

  • IMovie too long for iDVD

    My iMovie is 1 hr. 17 min. long. After setting preferences to Best Quality, it says the movie is too long for iDVD. How do I cut the movie into 2 sections to put onto 2 DVD's?

    STR,
    This may not be a practical suggestion for you, but if you had access to a good quality S-VHS recorder (or HI8) , you could export your video to two discs, burning for maximum image quality straight from iMovie, and transferring that material onto a single S-VHS tape or HI8 tape ?
    I find the maximum length of PAL video I can burn onto a 4.7GB disc for best quality is less that 58 minutes; above that duration, the quality deteriorates quite badly .
    jcr

  • It's taking way too long for my messages to load.

    Starting on Tuesday this week (10/14) it is taking way too long for my messages to load from my Gmail account. Once the message finally shows up in the Inbox, it's taking up to 10-15 min for the message to load where I can actually view the message. I'm going to have to move to another email application if this can't be resolved which is very unfortunate as I've enjoyed using Thunderbird up until now.

    I guess I'm at least happy to know it's not just me. I've had to abandon Thunderbird for now. I guess I'll keep an eye out for future updates.

Maybe you are looking for

  • Bluetooth 3.0 connection problem with keyboard - Mac OSX 10.6.8

    I have a white Macbook running OSX 10.6.8, which I cannot get to pair with bluetooth 3.0 keyboard. Recognises the device but cannot pair. I have deleted bluetooth plist, done a full reboot, reset PRAM, and checked that all software up to date. Have t

  • Router/gateway mode and NAT

    In a posting in this site, it was suggested that NAT replaces router/gateway mode as used on the WRT54GS.  I am wondering if that is correct. Why?  I have a WRT54GS (firmware v4.71.4, Oct. 31, 2007). This works: I have a class C IP block (full 256 ad

  • Power Mac 6100 and Mac IIsi Files rescue needed

    I have a PowerMac 6100 and a Mac IIsi that I need to rescue the files I have on the hard drives. I haven't turned either of these babies on since 2000. Do you think I have a chance of rescuing them? When I shut down my PowerMac before I moved I could

  • Taxes in stock transport orders

    Hi SAP Experts, We are doing cross-company STO without billing. We are creating UB purchase orders and the settlement is done through company code clearing accounts. Everything looks fine except that we need to include use (purchasing) taxes since we

  • The LenovoEZ device is currently unavailable.

    I get this message ALL THE TIME and the poerformance of the device is f******g slow. I am sorely disappointed. I bought the 3TB device S/N V3AR 160086 jsut three days ago and it is practically useless.