Asfunction, cursor states, and moviclips...oh my

Hello all. I've ran into a bit of a snag and I'm thinking the
obvious is sitting right in front of me...
I have a dynamic movieclip that is created to serve as a
container for a dynamically created textfield. The textfield has
html text. Within that html text is an asfunction to call a method.
Code is posted below:
MovieClip(this.createEmptyMovieClip("textOneContainer_mc",
this.getNextHighestDepth());
TextField(textOneContainer_mc.createTextField("textOneField",
textOneContainer_mc.getNextHighestDepth(), 10, 10, 300, 30));
// Method triggered from asfunction call from html text
textOneContainer_mc.launchGlossary = function(arg){
trace("Launch Glossary Method Hit, Glossary Word: "+arg);
textOneContainer_mc. textOneField.html = true;
textOneContainer_mc. textOneField.htmlText = htmlString_str;
Now the issues are:
1. if applied, textOneContainer_mc onRollOver, onRollOut,
onRelease, and etc seem to not allow the asfunction to be called
2. i'm using custom cursors, which work fine...however, the
system hand cursor appears over the word I have linked via
asfunction. I've tried using the useHandCursor = false MovieClip
property, but it still appears.
I hope this makes sense, i'm a little dumbfounded on this
one. The last thing I want to do is to do a split on the html text
and put each word in it's own MovieClip just to achieve what the
asfunction already does.

// Store Text and Audio Data From XML
var pagetext_xmlnodeOne:XMLNode =
matchSiblingNode(_parent.currentPage_xmlnode.firstChild,"instructionalTextOne");
var pagetext_xmlnodeTwo:XMLNode =
matchSiblingNode(_parent.currentPage_xmlnode.firstChild,"instructionalTextTwo");
var swf_xmlnode:XMLNode =
matchSiblingNode(_parent.currentPage_xmlnode.firstChild,"externalSwfFile");
var swfLocation:String = swf_xmlnode.attributes.swfFilePath;
var textOneAudio:String =
pagetext_xmlnodeOne.attributes.audioPath;
var textTwoAudio:String =
pagetext_xmlnodeTwo.attributes.audioPath;
var titleText:String =
_parent.currentPage_xmlnode.attributes.title;
var textOne_str:String =
pagetext_xmlnodeOne.firstChild.nodeValue;
var textTwo_str:String =
pagetext_xmlnodeTwo.firstChild.nodeValue;
trace("///// Title Text: "+titleText+"
//Loads SWF File
function loadSWF(externalSwfLocation:String){
var swfFile:Boolean = false;
//Object to Load SWF File
var mcLoader:MovieClipLoader = new MovieClipLoader();
var mclListener:Object = new Object();
if (externalSwfLocation != undefined){
if (externalSwfLocation.indexOf(".swf") > 0){
swfFile = true;
trace(".SWF Path: "+externalSwfLocation+" Target Clip:
"+mediaSWF_mc);
mcLoader.loadClip(externalSwfLocation,mediaSWF_mc);
image_mc = mediaSWF_mc;
} else {
//In the Event There is No SWF File, loadText Method Called
trace("No SWF File to Load, loadText Method Being Called");
loadText(textOne_str,textTwo_str,textOneAudio,textTwoAudio);
mcLoader.addListener(mclListener);
mclListener.onLoadComplete = function(){
trace(".swf Loaded Successfully");
trace("loadText Method Being Called");
loadText(textOne_str,textTwo_str,textOneAudio,textTwoAudio);
mclListener.onLoadInit = function(target_mc:MovieClip){
//Adjust SWF
var pictH:Number = target_mc._height;
var pictW:Number = target_mc._width;
var pictX:Number = target_mc._x;
var pictY:Number = target_mc._y;
if (swfFile){
pictH = Number(swf_xmlnode.attributes.swfHeight);
pictW = Number(swf_xmlnode.attributes.swfWidth);
if(swf_xmlnode.attributes.swfX!=undefined){
pictX = Number(swf_xmlnode.attributes.swfX);
} else { pictX = 0 };
if(swf_xmlnode.attributes.swfY!=undefined){
pictY = Number(swf_xmlnode.attributes.swfY);
} else { pictY = 0 };
//Adjust to New SWF Size and _x/_y Cooordinates
mediaSWF_mc._width = pictW;
mediaSWF_mc._height = pictH
mediaSWF_mc._x = pictX;
mediaSWF_mc._y = pictY;
mediaSWF_mc._alpha = 0;
// loadText Method
// Creates Movieclips to Store Textfield Data
function loadText(textOne_str:String, textTwo_str:String,
textOneAudio:String,textTwoAudio:String){
if(pagetext_xmlnodeOne.attributes._y!=undefined){
var txtOneY_num:Number = pagetext_xmlnodeOne.attributes._y;
} else {
var txtOneY_num:Number = 0;
var txtOneBlock:String =
pagetext_xmlnodeOne.attributes.textBlock;
if(textOne_str!=undefined){
var vlaInstrOneTxt_mc =
MovieClip(this.createEmptyMovieClip("vlaInstrOneTxt_mc",
this.getNextHighestDepth()));
var vlaInstrOne_txt =
TextField(vlaInstrOneTxt_mc.createTextField("vlaInstrOne_txt",
vlaInstrOneTxt_mc.getNextHighestDepth(), 8, txtOneY_num, 0, 0));
var vlaInstrOneFld = vlaInstrOneTxt_mc.vlaInstrOne_txt;
vlaInstrOneFld.autoSize = "left";
vlaInstrOneFld.embedFonts = true;
vlaInstrOneFld.selectable = false;
vlaInstrOneFld.multiline = true;
vlaInstrOneFld.border = false;
vlaInstrOneFld.html = true;
vlaInstrOneFld.htmlText = textOne_str;
vlaInstrOneTxt_mc.enabled = false;
vlaInstrOneTxt_mc._alpha = 0;
vlaInstrOneTxt_mc.launchGlossary = function(arg){
trace ("You clicked me!Argument was "+arg);
if(pagetext_xmlnodeTwo.attributes._y!=undefined){
var txtTwoY_num:Number = pagetext_xmlnodeTwo.attributes._y;
} else {
var txtTwoY_num:Number = 0;
var txtOneBlock:String =
pagetext_xmlnodeOne.attributes.textBlock;
if(textTwo_str!=undefined){
var vlaInstrTwoTxt_mc =
MovieClip(this.createEmptyMovieClip("vlaInstrTwoTxt_mc",
this.getNextHighestDepth()));
var vlaInstrTwo_txt =
TextField(vlaInstrTwoTxt_mc.createTextField("vlaInstrTwo_txt",
vlaInstrTwoTxt_mc.getNextHighestDepth(), 8, txtTwoY_num, 0, 0));
var vlaInstrTwoFld = vlaInstrTwoTxt_mc.vlaInstrTwo_txt;
vlaInstrTwoFld.autoSize = "left";
vlaInstrTwoFld.embedFonts = true;
vlaInstrTwoFld.selectable = false;
vlaInstrTwoFld.multiline = true;
vlaInstrTwoFld.border = false;
vlaInstrTwoFld.html = true;
vlaInstrTwoFld.htmlText = textTwo_str;
vlaInstrTwoTxt_mc.enabled = false;
vlaInstrTwoTxt_mc._alpha = 0;
var vlaInstrText_fmt:TextFormat = new TextFormat();
vlaInstrText_fmt.font = "VAGRoundedRegular";
vlaInstrOneFld.setTextFormat(vlaInstrText_fmt);
vlaInstrTwoFld.setTextFormat(vlaInstrText_fmt);
// Make Sure Text Stays Within Bounds
if(pagetext_xmlnodeOne.attributes.textBlock == "Left"){
if(vlaInstrOneFld._width > 375){
vlaInstrOneFld.wordWrap = true;
vlaInstrOneFld._width = 375;
} else {
if(vlaInstrOneFld._width > 670){
vlaInstrOneFld.wordWrap = true;
vlaInstrOneFld._width = 670;
if(pagetext_xmlnodeTwo.attributes.textBlock == "Left"){
if(vlaInstrTwoFld._width > 375){
vlaInstrTwoFld.wordWrap = true;
vlaInstrTwoFld._width = 375;
} else {
if(vlaInstrTwoFld._width > 670){
vlaInstrTwoFld.wordWrap = true;
vlaInstrTwoFld._width = 670;
// Call Transitions Clip for TextFields
trace("All Textfield Clips Loaded, Transitions and Audio
Will Now Take Place");
transitionInFirstTxtClip();
// Apply Transitions Clip to First TextField
function transitionInFirstTxtClip(){
if(textOne_str!=undefined){
fadeIn(vlaInstrOneTxt_mc, 7, this, "readFirstAudioClip");
} else {
trace("No Instructional Text 1 Found, calling
readFirstAudioClip");
readFirstAudioClip();
// Play Audio Related to First TextField
function readFirstAudioClip(){
if(textOneAudio!=undefined){
playSFX(textOneAudio, this, "nextClipTransition");
vlaInstrOneTxt_mc.enabled = true;
} else {
trace("No Instructional Text 1 Audio File Found, calling
nextClipTransition");
nextClipTransition();
// Apply Transtions Clip to Second TextField
function nextClipTransition(){
if(textTwo_str!=undefined){
fadeIn(vlaInstrTwoTxt_mc, 7, this, "readSecondAudioClip");
} else {
trace("No Instructional Text 2 Found, calling
readSecondAudioClip");
readSecondAudioClip();
/// Play Audio Related to Second TextField
function readSecondAudioClip(){
if(textTwoAudio!=undefined){
playSFX(textTwoAudio, this, "displaySwfFile");
vlaInstrTwoTxt_mc.enabled = true;
} else {
trace("No Instructional Text 2 Audio File Found, calling
displaySwfFile");
displaySwfFile();
// Display SWF File
function displaySwfFile(){
if(swfLocation!=undefined){
fadeIn(mediaSWF_mc, 1, this, "applyCursorStates");
} else {
trace("No SWF File Found, calling applyCursorStates");
//applyCursorStates();
function applyCursorStates(){
// Apply MovieClip Methods to TextField
vlaInstrOneTxt_mc.onRollOver = vlaInstrTwoTxt_mc.onRollOver
=function(){
cursorRollOverAudio();
vlaInstrOneTxt_mc.onRollOut = vlaInstrTwoTxt_mc.onRollOut
=function(){
cursorRollOutAudio();
vlaInstrOneTxt_mc.onRelease = function(){
cursorRollOverAudio();
playSFX(textOneAudio);
vlaInstrTwoTxt_mc.onRelease = function(){
cursorRollOverAudio();
playSFX(textTwoAudio);
var __soundFX:Sound = new Sound();
var audioFlag:Boolean = false;
function playSFX(audioClip:String, targ:MovieClip,
onComplete:String):Void {
__soundFX.onLoad = function(success:Boolean){
if(success){
if(!audioFlag){
audioFlag = true;
__soundFX.start();
trace("Audio Clip: "+audioClip+" is Now Playing");
} else {
__soundFX.stop();
audioFlag = false;
trace("Audio Clip Stopped");
var args = arguments.slice(3, arguments.length);
__soundFX.onSoundComplete = function() {
audioFlag = false;
trace("Audio Clip Completed");
if(onComplete!=undefined){
trace("Audio "+audioClip+" Completed, Calling onComplete
Method: "+onComplete);
targ[onComplete](args);
} else {
trace("Audio Completed, no onComplete Method to Call");
__soundFX.loadSound(audioClip,false);
// Stop Audio Method
function stopSFX():Void {
trace("__PLAYER: AUDIO CLIP STOPPED");
__soundFX.stop();
loadSWF(swfLocation);

Similar Messages

  • Case statement and Decode function both are not working in Select cursor.

    I have tried both the Case statement and Decode function in Select cursor, but both the things are not working. On the other hand both the things work in just select statement.
    See the first column in select (PAR_FLAG), I need to have this evaluated along with other fields. Can you please suggest some thing to make this work. And also I would like to
    know the reason why decode is not working, I heard some where Case statement do not work with 8i.
    Author : Amit Juneja
    Date : 06/20/2011
    Description:
    Updates the Diamond MEMBER_MASTER table with the values from
    INC.MEM_NJ_HN_MEMBER_XREF table.
    declare
    rec_cnt number(12) := 0;
    commit_cnt number(4) := 0;
    cursor select_cur is
    Select DECODE(1,
    (Select 1
    from hsd_prov_contract R
    where R.seq_prov_id = PM.seq_prov_id
    and R.line_of_business = H.line_of_business
    and R.PCP_FLAG = 'Y'
    and R.participation_flag = 'P'
    and SYSDATE between R.EFFECTIVE_DATE AND
    NVL(R.TERM_DATE,
    TO_DATE('31-DEC-9999', 'DD-MON-YYYY'))),
    'Y',
    'N') PAR_FLAG,
    H.SEQ_ELIG_HIST,
    H.SEQ_MEMB_ID,
    H.SEQ_SUBS_ID,
    H.SUBSCRIBER_ID,
    H.PERSON_NUMBER,
    H.EFFECTIVE_DATE,
    H.TERM_DATE,
    H.TERM_REASON,
    H.RELATIONSHIP_CODE,
    H.SEQ_GROUP_ID,
    H.PLAN_CODE,
    H.LINE_OF_BUSINESS,
    H.RIDER_CODE_1,
    H.RIDER_CODE_2,
    H.RIDER_CODE_3,
    H.RIDER_CODE_4,
    H.RIDER_CODE_5,
    H.RIDER_CODE_6,
    H.RIDER_CODE_7,
    H.RIDER_CODE_8,
    H.MEDICARE_STATUS_FLG,
    H.OTHER_STATUS_FLAG,
    H.HIRE_DATE,
    H.ELIG_STATUS,
    H.PREM_OVERRIDE_STEP,
    H.PREM_OVERRIDE_AMT,
    H.PREM_OVERRIDE_CODE,
    H.SEQ_PROV_ID,
    H.IPA_ID,
    H.PANEL_ID,
    H.SEQ_PROV_2_ID,
    H.SECURITY_CODE,
    H.INSERT_DATETIME,
    H.INSERT_USER,
    H.INSERT_PROCESS,
    H.UPDATE_DATETIME,
    H.UPDATE_USER,
    H.UPDATE_PROCESS,
    H.USER_DEFINED_1,
    H.SALARY,
    H.PEC_END_DATE,
    H.REASON_CODE,
    H.PEC_WAIVED,
    H.BILL_EFFECTIVE_FROM_DATE,
    H.BILLED_THRU_DATE,
    H.PAID_THRU_DATE,
    H.SUBSC_DEPT,
    H.SUBSC_LOCATION,
    H.USE_EFT_FLG,
    H.BENEFIT_START_DATE,
    H.SEQ_ENROLLMENT_RULE,
    H.MCARE_RISK_ACCRETION_DATE,
    H.MCARE_RISK_DELETION_DATE,
    H.MCARE_RISK_REFUSED_DATE,
    H.COMMENTS,
    H.USER_DEFINED_2,
    H.USER_DEFINED_3,
    H.RATE_TYPE,
    H.PCPAA_OCCURRED,
    H.PRIVACY_ON,
    H.PCP_CHANGE_REASON,
    H.SITE_CODE,
    H.SEQ_SITE_ADDRESS_ID,
    PM.seq_prov_id rendered_prov
    from hsd_member_elig_history H,
    INC.PCP_REASSIGN_RPRT_DATA P,
    hsd_prov_master PM
    where P.subscriber_id = H.subscriber_id
    and P.rendered_pcp = PM.provider_ID
    and H.elig_status = 'Y'
    and (H.term_date is NULL or H.term_date >= last_day(sysdate))
    order by H.Seq_memb_id;
    begin
    for C in select_cur loop
    rec_cnt := rec_cnt + 1;
    update hsd_member_elig_history
    set term_date = TRUNC(SYSDATE - 1),
    term_reason = 'PCPTR',
    update_datetime = SYSDATE,
    update_user = USER,
    update_process = 'TD33615'
    where seq_elig_hist = C.seq_elig_hist
    and seq_memb_id = C.seq_memb_id;
    INSERT INTO HSD_MEMBER_ELIG_HISTORY
    (SEQ_ELIG_HIST,
    SEQ_MEMB_ID,
    SEQ_SUBS_ID,
    SUBSCRIBER_ID,
    PERSON_NUMBER,
    EFFECTIVE_DATE,
    TERM_DATE,
    TERM_REASON,
    RELATIONSHIP_CODE,
    SEQ_GROUP_ID,
    PLAN_CODE,
    LINE_OF_BUSINESS,
    RIDER_CODE_1,
    RIDER_CODE_2,
    RIDER_CODE_3,
    RIDER_CODE_4,
    RIDER_CODE_5,
    RIDER_CODE_6,
    RIDER_CODE_7,
    RIDER_CODE_8,
    MEDICARE_STATUS_FLG,
    OTHER_STATUS_FLAG,
    HIRE_DATE,
    ELIG_STATUS,
    PREM_OVERRIDE_STEP,
    PREM_OVERRIDE_AMT,
    PREM_OVERRIDE_CODE,
    SEQ_PROV_ID,
    IPA_ID,
    PANEL_ID,
    SEQ_PROV_2_ID,
    SECURITY_CODE,
    INSERT_DATETIME,
    INSERT_USER,
    INSERT_PROCESS,
    UPDATE_DATETIME,
    UPDATE_USER,
    UPDATE_PROCESS,
    USER_DEFINED_1,
    SALARY,
    PEC_END_DATE,
    REASON_CODE,
    PEC_WAIVED,
    BILL_EFFECTIVE_FROM_DATE,
    BILLED_THRU_DATE,
    PAID_THRU_DATE,
    SUBSC_DEPT,
    SUBSC_LOCATION,
    USE_EFT_FLG,
    BENEFIT_START_DATE,
    SEQ_ENROLLMENT_RULE,
    MCARE_RISK_ACCRETION_DATE,
    MCARE_RISK_DELETION_DATE,
    MCARE_RISK_REFUSED_DATE,
    COMMENTS,
    USER_DEFINED_2,
    USER_DEFINED_3,
    RATE_TYPE,
    PCPAA_OCCURRED,
    PRIVACY_ON,
    PCP_CHANGE_REASON,
    SITE_CODE,
    SEQ_SITE_ADDRESS_ID)
    values
    (hsd_seq_elig_hist.nextval,
    C.SEQ_MEMB_ID,
    C.SEQ_SUBS_ID,
    C.SUBSCRIBER_ID,
    C.PERSON_NUMBER,
    trunc(SYSDATE),
    C.TERM_DATE,
    C.TERM_REASON,
    C.RELATIONSHIP_CODE,
    C.SEQ_GROUP_ID,
    C.PLAN_CODE,
    C.LINE_OF_BUSINESS,
    C.RIDER_CODE_1,
    C.RIDER_CODE_2,
    C.RIDER_CODE_3,
    C.RIDER_CODE_4,
    C.RIDER_CODE_5,
    C.RIDER_CODE_6,
    C.RIDER_CODE_7,
    C.RIDER_CODE_8,
    C.MEDICARE_STATUS_FLG,
    C.OTHER_STATUS_FLAG,
    C.HIRE_DATE,
    C.ELIG_STATUS,
    C.PREM_OVERRIDE_STEP,
    C.PREM_OVERRIDE_AMT,
    C.PREM_OVERRIDE_CODE,
    C.SEQ_PROV_ID,
    C.IPA_ID,
    C.PANEL_ID,
    C.SEQ_PROV_2_ID,
    C.SECURITY_CODE,
    SYSDATE,
    USER,
    'TD33615',
    SYSDATE,
    USER,
    'TD33615',
    C.USER_DEFINED_1,
    C.SALARY,
    C.PEC_END_DATE,
    C.REASON_CODE,
    C.PEC_WAIVED,
    C.BILL_EFFECTIVE_FROM_DATE,
    C.BILLED_THRU_DATE,
    C.PAID_THRU_DATE,
    C.SUBSC_DEPT,
    C.SUBSC_LOCATION,
    C.USE_EFT_FLG,
    C.BENEFIT_START_DATE,
    C.SEQ_ENROLLMENT_RULE,
    C.MCARE_RISK_ACCRETION_DATE,
    C.MCARE_RISK_DELETION_DATE,
    C.MCARE_RISK_REFUSED_DATE,
    C.COMMENTS,
    C.USER_DEFINED_2,
    C.USER_DEFINED_3,
    C.RATE_TYPE,
    C.PCPAA_OCCURRED,
    C.PRIVACY_ON,
    C.PCP_CHANGE_REASON,
    C.SITE_CODE,
    C.SEQ_SITE_ADDRESS_ID);
    commit_cnt := commit_cnt + 1;
    if (commit_cnt = 1000) then
    dbms_output.put_line('Committed updates for 1000 records.');
    commit;
    commit_cnt := 0;
    end if;
    end loop;
    commit;
    dbms_output.put_line('Total number of MEMBER_ELIG_HISTROY records inserted : ' ||
    rec_cnt);
    exception
    when others then
    raise_application_error(-20001,
    'An error was encountered - ' || sqlcode ||
    ' -error- ' || sqlerrm);
    end;

    user10305724 wrote:
    I have tried both the Case statement and Decode function in Select cursor, but both the things are not working. Please define what you mean by not working even if your computer screen is near the internet we can't see it.
    You should also look at the FAQ about how to ask a question
    SQL and PL/SQL FAQ
    Particularly *9) Formatting with {noformat}{noformat} Tags* and posting your version.
    know the reason why decode is not working, I heard some where Case statement do not work with 8i.
    Does this mean you are using 8i? Then scalar sub queries - selects within the select list, are not supported, along with CASE in PL/SQL.
    Select DECODE(1,
    * (Select 1
    from hsd_prov_contract R
    where R.seq_prov_id = PM.seq_prov_id
    and R.line_of_business = H.line_of_business
    and R.PCP_FLAG = 'Y'
    and R.participation_flag = 'P'
    and SYSDATE between R.EFFECTIVE_DATE AND
    NVL(R.TERM_DATE,
    TO_DATE('31-DEC-9999', 'DD-MON-YYYY')))*,
    'Y',
    'N') PAR_FLAG,
    >
    exception
    when others then
    raise_application_error(-20001,
    'An error was encountered - ' || sqlcode ||
    ' -error- ' || sqlerrm);
    http://tkyte.blogspot.com/2008/01/why-do-people-do-this.html                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Closing Statements and ResultSets

    I just recently realized that you need to close Statements and ResultSets in order to avoid getting the "Too many cursors"-message.
    My question is:
    Do you need to close both Statements and ResultSets?
    - not that it's a problem...
    if so:
    Does it matter which one you close first?

    I usually place the stmt.close() code in my finally block, to ensure that the statement gets closed, even if a SQLException occurs during the query/update. The ResultSet does not explicitly have to be closed, ... it is automatically closed when the Statement is closed, or if a new query is run on the same statement.

  • JDBC: Closing Connection does it close statement and resultset

    In my application I am facing ORA-0100 Maximum open cursors exceeded problem. We are executing quite a few queries and stored procedures before we close the connection object. But in few places statements and resultsets are not closed. Can these be a problem? Shouldn't they be automatically closed when the connection is closed?
    We are executing this block of code in a loop.

    in few places statements and
    resultsets are not closed. Can these be a problem?Yes.

  • Can we open and close the cursor again and again

    hi all,
    with the help of cursor select statement i am writing some columns into the text file. while writing into the file in between i want to write something which belongs to others cursor. shall i close the first cursor and reopen it again..
    is its works?

    If you are using for loop the you don't need to open and close the cursor like:
    SQL> set autot off
    SQL> begin
      2     for i in (select ename, deptno, sal from emp)
      3     loop
      4             for j in (select dname from dept where deptno = i.deptno)
      5             loop
      6             dbms_output.put_line ('Ename:' || i.Ename ||'  Dept Name:'|| j.dname);
      7             end loop;
      8     end loop;
      9  end;
    10  /
    PL/SQL procedure successfully completed.
    SQL> set serveroutput on
    SQL> /
    Ename:SCOTT  Dept Name:RESEARCH
    Ename:first_0  Dept Name:SALES
    Ename:first_1  Dept Name:SALES
    Ename:first_0  Dept Name:RESEARCH
    Ename:first_1  Dept Name:SALES
    Ename:first_0  Dept Name:SALES
    Ename:first_1  Dept Name:ACCOUNTING
    Ename:first_0  Dept Name:RESEARCH
    Ename:first_1  Dept Name:ACCOUNTING
    Ename:first_0  Dept Name:SALES
    Ename:first_1  Dept Name:RESEARCH
    Ename:first_0  Dept Name:SALES
    Ename:first_1  Dept Name:RESEARCH
    Ename:first_0  Dept Name:ACCOUNTING
    PL/SQL procedure successfully completed.
    SQL> Or let us know about your requirements i.e. why you need to open/close the cursor again and again.

  • Invalid Cursor state Exception  -  Help required

    Hi,
    I'm having a web page(JSP), which is making use of 3 ResultSet objects. Using the first two, i'll populate two different Drop down list, with values from database(Access) while loading the page for first time.
    Now if the user select any value from any (or both) of drop down list and clicks submit, i need to display all values in database, meeting the criteria from first & second drop down list. For this selection, i'm using the third ResultSet variable. While executing the query, i'm sure that 3rd ResultSet is returning some value. But when i try to retrieve the value to a string variable, i'm getting the Invalid cursor state exception.
    Throughout the page, i haven't closed any of the ResultSet. When i closed the first and second ResultSets in the third function(where 3rd ResultSet is used), i'm not getting any value. Its returning like ResultSet closed.
    Please help me to get this solved. It's very urgent because without this, i cannot proceed further. Please share your ideas.
    Thanks in advace for your valuable help

    If you open a new resultset within the same statement, all previously opened will be closed.
    Read the API docs, luke.

  • Invalid cursor state when trying to insert record

    Hi everyone!
    I'm using JDBC-ODBC bridge to connect to a mySql database, which works fine. Then I try to insert new records, but this only works for the first record in the table.
    When there is already a record in the table, I always get "[Microsoft][ODBC Driver Manager] Invalid cursor state" when calling the updateRow()-method of the result set.
    Here is my code:            // open db connection
                Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                Connection conn = DriverManager.getConnection("jdbc:odbc:TTManager", "xxxx", "xxxx");
                // Prepare SQL statement
                java.sql.Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
                ResultSet result = stmt.executeQuery("SELECT * FROM Player");
                result.moveToInsertRow();Then all fields are filled in this manner:            result.updateString("Name", name);And finally the insertRow should be written to the db:            result.insertRow();But at this point it gives the mentioned error, including these messages:         at sun.jdbc.odbc.JdbcOdbcResultSet.setPos(JdbcOdbcResultSet.java:5272)
            at sun.jdbc.odbc.JdbcOdbcResultSet.insertRow(JdbcOdbcResultSet.java:4132)Since I'm very unexperienced with Java, I guess (or hope^^) it's just some stupid beginner's mistake.
    Oh, almost forgot to mention: The new record's data doesn't violate any unique-constraints on the table, all fields are explicitely filled and all variable's data types are matching their according field types!
    Any help would be appreciated!
    reinski

    Ok, I needed to help myself and this is what I found out:
    If the table already contains records, it is not enough to doresult.moveToInsertRow();but I must beresult.last();
    result.moveToInsertRow();I didn't find any explanation and even the code examples from the Sun tutorial don't mention this, so I guess it's a bug occurring in my poor IT environment: DB server running mySQL 5.0.0-alpha on a P1-233-MMX w/ 64MB under WinNT4 (hey don't laugh!!^^).
    Maybe this information is of use to someone having similar problems...
    Greetings!
    reinski

  • Bind Variable in SELECT statement and get the value  in PL/SQL block

    Hi All,
    I would like  pass bind variable in SELECT statement and get the value of the column in Dynamic SQL
    Please seee below
    I want to get the below value
    Expected result:
    select  distinct empno ,pr.dept   from emp pr, dept ps where   ps.dept like '%IT'  and pr.empno =100
    100, HR
    select  distinct ename ,pr.dept   from emp pr, dept ps where   ps.dept like '%IT'  and pr.empno =100
    TEST, HR
    select  distinct loc ,pr.dept   from emp pr, dept ps where   ps.dept like '%IT'  and pr.empno =100
    NYC, HR
    Using the below block I am getting column names only not the value of the column. I need to pass that value(TEST,NYC..) into l_col_val variable
    Please suggest
    ----- TABLE LIST
    CREATE TABLE EMP(
    EMPNO NUMBER,
    ENAME VARCHAR2(255),
    DEPT VARCHAR2(255),
    LOC    VARCHAR2(255)
    INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (100,'TEST','HR','NYC');
    INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (200,'TEST1','IT','NYC');
    INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (300,'TEST2','MR','NYC');
    INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (400,'TEST3','HR','DTR');
    INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (500,'TEST4','HR','DAL');
    INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (600,'TEST5','IT','ATL');
    INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (700,'TEST6','IT','BOS');
    INSERT INTO EMP (EMPNO,ENAME,DEPT,LOC) VALUES (800,'TEST7','HR','NYC');
    COMMIT;
    CREATE TABLE COLUMNAMES(
    COLUMNAME VARCHAR2(255)
    INSERT INTO COLUMNAMES(COLUMNAME) VALUES ('EMPNO');
    INSERT INTO COLUMNAMES(COLUMNAME) VALUES ('ENAME');
    INSERT INTO COLUMNAMES(COLUMNAME) VALUES ('DEPT');
    INSERT INTO COLUMNAMES(COLUMNAME) VALUES ('LOC');
    COMMIT;
    CREATE TABLE DEPT(
    DEPT VARCHAR2(255),
    DNAME VARCHAR2(255)
    INSERT INTO DEPT(DEPT,DNAME) VALUES ('IT','INFORMATION TECH');
    INSERT INTO DEPT(DEPT,DNAME) VALUES ('HR','HUMAN RESOURCE');
    INSERT INTO DEPT(DEPT,DNAME) VALUES ('MR','MARKETING');
    INSERT INTO DEPT(DEPT,DNAME) VALUES ('IT','INFORMATION TECH');
    COMMIT;
    PL/SQL BLOCK
    DECLARE
      TYPE EMPCurTyp  IS REF CURSOR;
      v_EMP_cursor    EMPCurTyp;
      l_col_val           EMP.ENAME%type;
      l_ENAME_val       EMP.ENAME%type;
    l_col_ddl varchar2(4000);
    l_col_name varchar2(60);
    l_tab_name varchar2(60);
    l_empno number ;
    b_l_col_name VARCHAR2(255);
    b_l_empno NUMBER;
    begin
    for rec00 in (
    select EMPNO aa from  EMP
    loop
    l_empno := rec00.aa;
    for rec in (select COLUMNAME as column_name  from  columnames
    loop
    l_col_name := rec.column_name;
    begin
      l_col_val :=null;
       l_col_ddl := 'select  distinct :b_l_col_name ,pr.dept ' ||'  from emp pr, dept ps where   ps.dept like ''%IT'' '||' and pr.empno =:b_l_empno';
       dbms_output.put_line('DDL ...'||l_col_ddl);
       OPEN v_EMP_cursor FOR l_col_ddl USING l_col_name, l_empno;
    LOOP
        l_col_val :=null;
        FETCH v_EMP_cursor INTO l_col_val,l_ename_val;
        EXIT WHEN v_EMP_cursor%NOTFOUND;
          dbms_output.put_line('l_col_name='||l_col_name ||'  empno ='||l_empno);
       END LOOP;
    CLOSE v_EMP_cursor;
    END;
    END LOOP;
    END LOOP;
    END;

    user1758353 wrote:
    Thanks Billy, Would you be able to suggest any other faster method to load the data into table. Thanks,
    As Mark responded - it all depends on the actual data to load, structure and source/origin. On my busiest database, I am loading on average 30,000 rows every second from data in external files.
    However, the data structures are just that - structured. Logical.
    Having a data structure with 100's of fields (columns in a SQL table), raise all kinds of questions about how sane that structure is, and what impact it will have on a physical data model implementation.
    There is a gross misunderstanding by many when it comes to performance and scalability. The prime factor that determines performance is not how well you code, what tools/language you use, the h/w your c ode runs on, or anything like that. The prime factor that determines perform is the design of the data model - as it determines the complexity/ease to use the data model, and the amount of I/O (the slowest of all db operations) needed to effectively use the data model.

  • Invalid Cursor State

    Hi all,
    i was using SAPB0 2007A 42Patches, try to use AP Purchase Order and AP Goods Receipt PO together add serial numbers for Item facing this error as below:
    [Goods Receipt PO - Rows - Warehouse Code][line: 1], '1).[Microsoft][SQL Native Client]Invalid cursor state 'Serial Numbers for Items' (OSRI)'
    [Purchase Order - Rows - Warehouse Code][line: 1], '1).[Microsoft][SQL Native Client]Invalid cursor state 'Serial Numbers for Items' (OSRI)'
    Can i have the solution from anyone?
    Thank you.
    Best Regards,
    danny

    Hi all,
    I know the caused of it.
    Because i have created triggers on these 2 table and on Serial Table.
    But why so strange, i have triggers on it and nothing error like this before this scenario happened.
    Cheers,
    danny ng

  • Invalid cursor state error

    Hello everyone i am building a database/web page application using Dreamweaver 8 that allows sudents to report computer issues. The submitting works fine it stores all information to the databse my problem now is updating the database to show a problem has been fixed. I can get the website to pull up current records using but when i click on the lik that should redirect the user to the update form which pulls up the record that the user clicked on i get this error:
    exception
    org.apache.jasper.JasperException: Exception in JSP: /updateIssue.jsp:151
    148:   <table align="center">
    149:     <tr valign="baseline">
    150:       <td nowrap align="right">Cpu:</td>
    151:       <td><input type="text" name="cpu" value="<%=(((IssueUpdate_data = IssueUpdate.getObject("cpu"))==null || IssueUpdate.wasNull())?"":IssueUpdate_data)%>" size="32">
    152:       </td>
    153:     </tr>
    154:     <tr valign="baseline">
    Stacktrace:
         org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:504)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause
    javax.servlet.ServletException: [Microsoft][ODBC Driver Manager] Invalid cursor state
         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:858)
         org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
         org.apache.jsp.updateIssue_jsp._jspService(updateIssue_jsp.java:284)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause
    java.sql.SQLException: [Microsoft][ODBC Driver Manager] Invalid cursor state
         sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
         sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
         sun.jdbc.odbc.JdbcOdbc.SQLGetDataString(Unknown Source)
         sun.jdbc.odbc.JdbcOdbcResultSet.getDataString(Unknown Source)
         sun.jdbc.odbc.JdbcOdbcResultSet.getString(Unknown Source)
         sun.jdbc.odbc.JdbcOdbcResultSet.getObject(Unknown Source)
         sun.jdbc.odbc.JdbcOdbcResultSet.getObject(Unknown Source)
         org.apache.jsp.updateIssue_jsp._jspService(updateIssue_jsp.java:226)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    My code for the page is:
    <%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" %>
    <%@ include file="Connections/db.jsp" %>
    <%
    // *** Edit Operations: declare variables
    // set the form action variable
    String MM_editAction = request.getRequestURI();
    if (request.getQueryString() != null && request.getQueryString().length() > 0) {
      String queryString = request.getQueryString();
      String tempStr = "";
      for (int i=0; i < queryString.length(); i++) {
        if (queryString.charAt(i) == '<') tempStr = tempStr + "<";
        else if (queryString.charAt(i) == '>') tempStr = tempStr + ">";
        else if (queryString.charAt(i) == '"') tempStr = tempStr +  """;
        else tempStr = tempStr + queryString.charAt(i);
      MM_editAction += "?" + tempStr;
    // connection information
    String MM_editDriver = null, MM_editConnection = null, MM_editUserName = null, MM_editPassword = null;
    // redirect information
    String MM_editRedirectUrl = null;
    // query string to execute
    StringBuffer MM_editQuery = null;
    // boolean to abort record edit
    boolean MM_abortEdit = false;
    // table information
    String MM_editTable = null, MM_editColumn = null, MM_recordId = null;
    // form field information
    String[] MM_fields = null, MM_columns = null;
    %>
    <%
    // *** Update Record: set variables
    if (request.getParameter("MM_update") != null &&
        request.getParameter("MM_update").toString().equals("form1") &&
        request.getParameter("MM_recordId") != null) {
      MM_editDriver     = MM_db_DRIVER;
      MM_editConnection = MM_db_STRING;
      MM_editUserName   = MM_db_USERNAME;
      MM_editPassword   = MM_db_PASSWORD;
      MM_editTable  = "issue";
      MM_editColumn = "cpu";
      MM_recordId   = "'" + request.getParameter("MM_recordId") + "'";
      MM_editRedirectUrl = "COBA_home.html";
      String MM_fieldsStr = "cpu|value|issue|value|comment|value|issue_Date|value|Fixed|value";
      String MM_columnsStr = "cpu|',none,''|issue|',none,''|comment|',none,''|issue_Date|',none,''|Fixed|',none,''";
      // create the MM_fields and MM_columns arrays
      java.util.StringTokenizer tokens = new java.util.StringTokenizer(MM_fieldsStr,"|");
      MM_fields = new String[tokens.countTokens()];
      for (int i=0; tokens.hasMoreTokens(); i++) MM_fields[i] = tokens.nextToken();
      tokens = new java.util.StringTokenizer(MM_columnsStr,"|");
      MM_columns = new String[tokens.countTokens()];
      for (int i=0; tokens.hasMoreTokens(); i++) MM_columns[i] = tokens.nextToken();
      // set the form values
      for (int i=0; i+1 < MM_fields.length; i+=2) {
        MM_fields[i+1] = ((request.getParameter(MM_fields)!=null)?(String)request.getParameter(MM_fields[i]):"");
    // append the query string to the redirect URL
    if (MM_editRedirectUrl.length() != 0 && request.getQueryString() != null) {
    MM_editRedirectUrl += ((MM_editRedirectUrl.indexOf('?') == -1)?"?":"&") + request.getQueryString();
    %>
    <%
    // *** Update Record: construct a sql update statement and execute it
    if (request.getParameter("MM_update") != null &&
    request.getParameter("MM_recordId") != null) {
    // create the update sql statement
    MM_editQuery = new StringBuffer("update ").append(MM_editTable).append(" set ");
    for (int i=0; i+1 < MM_fields.length; i+=2) {
    String formVal = MM_fields[i+1];
    String elem;
    java.util.StringTokenizer tokens = new java.util.StringTokenizer(MM_columns[i+1],",");
    String delim = ((elem = (String)tokens.nextToken()) != null && elem.compareTo("none")!=0)?elem:"";
    String altVal = ((elem = (String)tokens.nextToken()) != null && elem.compareTo("none")!=0)?elem:"";
    String emptyVal = ((elem = (String)tokens.nextToken()) != null && elem.compareTo("none")!=0)?elem:"";
    if (formVal.length() == 0) {
    formVal = emptyVal;
    } else {
    if (altVal.length() != 0) {
    formVal = altVal;
    } else if (delim.compareTo("'") == 0) {  // escape quotes
    StringBuffer escQuotes = new StringBuffer(formVal);
    for (int j=0; j < escQuotes.length(); j++)
    if (escQuotes.charAt(j) == '\'') escQuotes.insert(j++,'\'');
    formVal = "'" + escQuotes + "'";
    } else {
    formVal = delim + formVal + delim;
    MM_editQuery.append((i!=0)?",":"").append(MM_columns[i]).append(" = ").append(formVal);
    MM_editQuery.append(" where ").append(MM_editColumn).append(" = ").append(MM_recordId);
    if (!MM_abortEdit) {
    // finish the sql and execute it
    Driver MM_driver = (Driver)Class.forName(MM_editDriver).newInstance();
    Connection MM_connection = DriverManager.getConnection(MM_editConnection,MM_editUserName,MM_editPassword);
    PreparedStatement MM_editStatement = MM_connection.prepareStatement(MM_editQuery.toString());
    MM_editStatement.executeUpdate();
    MM_connection.close();
    // redirect with URL parameters
    if (MM_editRedirectUrl.length() != 0) {
    response.sendRedirect(response.encodeRedirectURL(MM_editRedirectUrl));
    return;
    %>
    <%
    String IssueUpdate__MMColParam = "1";
    if (request.getParameter("cpu") !=null) {IssueUpdate__MMColParam = (String)request.getParameter("cpu");}
    %>
    <%
    Driver DriverIssueUpdate = (Driver)Class.forName(MM_db_DRIVER).newInstance();
    Connection ConnIssueUpdate = DriverManager.getConnection(MM_db_STRING,MM_db_USERNAME,MM_db_PASSWORD);
    PreparedStatement StatementIssueUpdate = ConnIssueUpdate.prepareStatement("SELECT * FROM issue WHERE cpu = '" + IssueUpdate__MMColParam + "' ORDER BY Fixed ASC");
    ResultSet IssueUpdate = StatementIssueUpdate.executeQuery();
    boolean IssueUpdate_isEmpty = !IssueUpdate.next();
    boolean IssueUpdate_hasData = !IssueUpdate_isEmpty;
    Object IssueUpdate_data;
    int IssueUpdate_numRows = 0;
    %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>
    </head>
    <body>
    <form method="post" action="<%=MM_editAction%>" name="form1">
    <table align="center">
    <tr valign="baseline">
    <td nowrap align="right">Cpu:</td>
    <td><input type="text" name="cpu" value="<%=(((IssueUpdate_data = IssueUpdate.getObject("cpu"))==null || IssueUpdate.wasNull())?"":IssueUpdate_data)%>" size="32">
    </td>
    </tr>
    <tr valign="baseline">
    <td nowrap align="right">Issue:</td>
    <td><input type="text" name="issue" value="<%=(((IssueUpdate_data = IssueUpdate.getObject("issue"))==null || IssueUpdate.wasNull())?"":IssueUpdate_data)%>" size="32">
    </td>
    </tr>
    <tr>
    <td nowrap align="right" valign="top">Comment:</td>
    <td valign="baseline"><textarea name="comment" cols="50" rows="5"><%=(((IssueUpdate_data = IssueUpdate.getObject("comment"))==null || IssueUpdate.wasNull())?"":IssueUpdate_data)%></textarea>
    </td>
    </tr>
    <tr valign="baseline">
    <td nowrap align="right">Issue_Date:</td>
    <td><input type="text" name="issue_Date" value="<%=(((IssueUpdate_data = IssueUpdate.getObject("issue_Date"))==null || IssueUpdate.wasNull())?"":IssueUpdate_data)%>" size="32">
    </td>
    </tr>
    <tr valign="baseline">
    <td nowrap align="right">Fixed:</td>
    <td><input type="text" name="Fixed" value="<%=(((IssueUpdate_data = IssueUpdate.getObject("Fixed"))==null || IssueUpdate.wasNull())?"":IssueUpdate_data)%>" size="32">
    </td>
    </tr>
    <tr valign="baseline">
    <td nowrap align="right"> </td>
    <td><input type="submit" value="Update record">
    </td>
    </tr>
    </table>
    <input type="hidden" name="MM_update" value="form1">
    <input type="hidden" name="MM_recordId" value="<%=(((IssueUpdate_data = IssueUpdate.getObject("cpu"))==null || IssueUpdate.wasNull())?"":IssueUpdate_data)%>">
    </form>
    <p> </p>
    </body>
    </html>
    <%
    IssueUpdate.close();
    StatementIssueUpdate.close();
    ConnIssueUpdate.close();
    %>
    Any idea as to what I have done wrong because I am very confused right now. Thank you so much in advance for any help or advice

    I am confused as well.
    It would help if your data layer was separate from your display layer.
    The error suggests that you are attempting to extract a result from a update. And that won't work with a standard update.
    Where that is happening I have no idea.

  • Invalid cursor state error while executing the prepared statement

    hai friends,
    following code showing the invalid cursor state error while executing the second prepared statement.
    pls anyone help me
    String query = "select * from order_particulars where order_no=" + orderno + " order by sno";             psmt1 = conEntry.prepareStatement(query, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);             rs1 = psmt1.executeQuery();             rs1.last();             intRowCount = rs1.getRow();             particularsdata = new Object[intRowCount][6];             rs1.beforeFirst();             if (intRowCount >= 1) {                 for (int i = 0; rs1.next(); i++) {                     particularsdata[0] = i + 1;
    particularsdata[i][1] = rs1.getString(3);
    particularsdata[i][2] = Double.parseDouble(rs1.getString(4));
    rs1.close();
    psmt1.close();
    query = "SELECT sum(delqty) FROM billdetails,billparticulars WHERE order_no= " + orderno + " and " +
    "billdetails.bill_no = billparticulars.bill_no GROUP BY particulars ORDER BY sno";
    psmt1 = conEntry.prepareStatement(query, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
    rs1 = psmt1.executeQuery(); //error showing while executing this line

    Also .. Why using arrays instead of collections? Shifting the cursor all the way forth and back to get the count is fairly terrible.
    With regard to the problem: either there's a nasty bug in the JDBC driver used, or you actually aren't running the compiled class version of the posted code.

  • Over State and actions not working with buttons in Flash cs4

    Hi - I am working on a Flash file and some of the buttons in the document are not working.When I test the movie the hand cursor appears when I hover over the buttons they don't change colour (as specified in the over state) and the actions don't work. Not sure what is going on here as I created other buttons in the same document the same way and they work fine. Thanks in advance.

    If you remove the code from the buttons do they react properly to a mouse over interaction?
    What is the code that is in place?

  • SQLException, invalid cursor state

    Came across the weirdest thing... Suppose i use this statement in a servlet:
    ResultSet result = statement.executeQuery("SELECT City FROM Destinations");and the following code in the JSP to which the browser is redirected:
    <select name="selectedCity" value="" size="1">
    <% ResultSet result = (ResultSet) session.getAttribute("rstCity");
    while (result.next()) { %>
         <option><%= result.getString(1) %>
    <% } %>
    </select>This works properly in my case. (Don't think other code is necessary to provide... please tell me you think it is..)
    But because result is full of duplicate rows, i want to change the line into:
    ResultSet result = statement.executeQuery("SELECT DISTINCT City FROM Destinations");A ServletException and SQLException message in the browser (at index.jsp, not servlet/servletname!) both say [Micrisoft][ODBC Driver Manager]Invalid Cursor State...
    Now if i (temporarily) remove the expression <%= result.getString(1) %> in the JSP file, the error no longer appears. Ofcourse the listbox <select> is now filled with about 100 empty <option>s...
    I can't locate the problem this way, can't see any logic in this. It seems like by adding DISTINCT in the SQL statement, the JSP file cannot handle the getString function anymore.
    Can anyone help me with this invalid cursor state thing?
    Thanks!!

    Peter,
    I'm getting the same problem with this:
    String sql = "SELECT DISTINCTROW collectedwho FROM steps WHERE status = 'overdue finish' AND escalatedwho = " + util.sqlEsc(username) + " ORDER BY collectedwho";
    recordset rs = new recordset();
    rs.open(sql);
    while (rs.rs.next()) {
    accountable = rs.rs.getString("collectedwho");
    (recordset is simply my own wrapper for the ResultSet class, which hides the db connection string and saves me rewriting it every time)
    What happens is that the loop falls off the end of the resultset but thinks that it hasn't, ie rs.next() returns true, but there's no data when it gets to the getString and it throws an "Invalid cursor state".
    Bummer.
    I'm using the JDBC:ODBC bridge to an access database, by the way.
    I tried changing DISTINCT to to DISTINCTROW which then worked with no errors but of course gave me the wrong results in the ResultSet!
    Is this a bug in the bridge, or in the ResultSet class?
    Sorry this isn't much help but at least you know you're not the only one!
    David

  • How open cursor statement works

    hi,
    OPEN CURSOR [WITH HOLD] dbcur FOR
      SELECT result
             FROM source
             [[FOR ALL ENTRIES IN itab] WHERE sql_cond]
             [GROUP BY group] [HAVING group_cond]
             [ORDER BY sort_key].
    i want to know what does open cursor statement do, how it works,  what does dbcur contain?

    Hi,
    dbcur is cursor name gn by u....
    Its like select statement....u hav used for all entries right....so if der are 3 records in ur int table and corresponding 3 records ll be fetched in select-endselect query right.....
    here in open cursor statement u don hav INTO(destination) right
    so after opening cursor......
    FETCH NEXT CURSOR dbcur into wa1.
    FETCH NEXT CURSOR dbcur into wa2.
    FETCH NEXT CURSOR dbcur into wa3.
    wa1,wa2,wa3 ll have the 3 records....
    close cursor.....................
    Cheers,
    jose.

  • HELP! INVALID CURSOR STATE

    i have this simple jsp page that will display a few data from an SQL Database... im just trying to check my connectivity. but everytime i view the page it says "[Microsoft][ODBC SQL Server Driver]Invalid
    cursor state'"my JSP environment is
    J2EE 1.2.1
    JDK 1.3.0_02
    BDK 1.1
    TOMCAT 3.2.1
    SQL Server 2000 Enterprise Edition
    Running on Windows 2000 server
    Heres my simple code:
    <%@ page language = "java" import = "java.sql.*" %>
    <html>
    <body>
    <%
    Connection con = null;
    try
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    con=DriverManager.getConnection("jdbc:odbc:testdsn:, "sa", "");
    Statement stmt = con.createStatement();
    Resultset rs = stmt.executeQuery("select * from testtable");
    while(rs.next());
    out.println(rs.getString(1));
    out.println(rs.getString(2));
    catch(Exception e)
    out.println(e.toString());
    %>
    </body>
    </html>
    my testtable have 2 columns and 6 rows all in varchar datatype with values:
    test 1 | a
    test 2 | b
    test 3 | c
    test 4 | d
    test 5 | e
    test 6 | f
    is there something wrong with the code? with my environment? please help im finishing a site for a school project but i cant seem to make jsp and sql work

    See if using PreparedStatement works better for you than Statement. Sometimes it has better manners.
    - Saish
    "My karma ran over your dogma." - Anon

Maybe you are looking for