Skip to main content

ACUSQL - UPDATE Record

  • November 1, 2011
  • 1 reply
  • 0 views

[Migrated content. Thread originally posted on 01 November 2011]

Using the same syntax as the sample in the manual. However when I go to update, I get "The cursor is READ ONLY".

Doing this to read the record.

EXEC SQL
DECLARE COBCUR1 CURSOR FOR
SELECT C_FIRST_NAME, C_LAST_NAME, C_CITY
FROM CUSTOMER
WHERE C_LAST_NAME = KEY-PASSED
FOR UPDATE
END-EXEC.

EXEC SQL
OPEN COBCUR1
END-EXEC.

EXEC SQL
FETCH COBCUR1
INTO :C-FIRST-NAME,
:C-LAST-NAME,
:C-CITY
END-EXEC

Then after user makes changes, I do the following.

EXEC SQL
UPDATE CUSTOMER SET
C_FIRST_NAME = :C-FIRST-NAME,
C_LAST_NAME = :C-LAST-NAME,
C_CITY = :C-CITY
WHERE CURRENT OF COBCUR1
END-EXEC

Then I get message "The cursor is READ ONLY"


In the config file I have the setting

ACUSQL_ODBC_CURSORS 0


Any ideas anyone?

Patty

1 reply

  • Author
  • Rocketeer
  • 19312 replies
  • November 1, 2011

[Migrated content. Thread originally posted on 01 November 2011]

Using the same syntax as the sample in the manual. However when I go to update, I get "The cursor is READ ONLY".

Doing this to read the record.

EXEC SQL
DECLARE COBCUR1 CURSOR FOR
SELECT C_FIRST_NAME, C_LAST_NAME, C_CITY
FROM CUSTOMER
WHERE C_LAST_NAME = KEY-PASSED
FOR UPDATE
END-EXEC.

EXEC SQL
OPEN COBCUR1
END-EXEC.

EXEC SQL
FETCH COBCUR1
INTO :C-FIRST-NAME,
:C-LAST-NAME,
:C-CITY
END-EXEC

Then after user makes changes, I do the following.

EXEC SQL
UPDATE CUSTOMER SET
C_FIRST_NAME = :C-FIRST-NAME,
C_LAST_NAME = :C-LAST-NAME,
C_CITY = :C-CITY
WHERE CURRENT OF COBCUR1
END-EXEC

Then I get message "The cursor is READ ONLY"


In the config file I have the setting

ACUSQL_ODBC_CURSORS 0


Any ideas anyone?

Patty
FIGURED OUT THE PROBLEM.

The WHERE statment s/b WHERE C_LAST_NAME = :KEY-PASSED


It did not work using WHERE CURRENT OF CURSOR_NAME.