Domanda

Been scratching my head for a while with what should be a simple Update Statement using the Java Based Squirrel SQL Client, version 3.4.0 (Note: This works fine in TOAD for Oracle, but long term I am expected to use Squirrel.

The query is:

UPDATE txn_header
SET KNZ = ' ', "TIMESTAMP" = ' '
WHERE ORGU_CODE_CMPY = '001'
and ORGU_CODE = '0040'
and TILL_SHORT_DESC = '061' 
and KNZ = 'WT'
and TXHD_TXN_NR between 729167 and 730881;

My problem is, TIMESTAMP is an Oracle PL/SQL reserved word. Research shows me that reserved words in Oracle should be encased in Double Quotes "TIMESTAMP". but this seems to execute the last successful query which ran.

I've also tried

'TIMESTAMP'
[TIMESTAMP] 
(TIMESTAMP = " ") 
("TIMESTAMP = " ") 

The blank space is intended

Last Successful query is:

SELECT knz, count(*) 
   from TXN_HEADER
group by knz

I'm confused to say the least and I'm no expert at Database Administration - Any help would be incredible.

Edit - Made 10/1/2013

I've also tried using back ticks on the TIMESTAMP column name

UPDATE txn_header
SET KNZ = ' ', TXN_HEADER.`TIMESTAMP` = ' ' 
WHERE ORGU_CODE_CMPY = '001' 
and ORGU_CODE = '0040'
and TILL_SHORT_DESC = '061' 
and KNZ = 'WT'
and TXHD_TXN_NR between '729167' and '729167'

I get the following error:

Error: ORA-00911: invalid character

SQLState:  42000
ErrorCode: 911
Position: 44

The GUI of Squirrel is pointing at the backticks which I've seen as the solution to reserved words for sometime..

The server I'm connected to is an Oracle 11 Server

Thank You, David Birkin

È stato utile?

Soluzione

With the following table def, the update works fine with v3.4:

create table txn_header (
    knz varchar2(100),
    "TIMESTAMP" timestamp,
    ORGU_CODE_CMPY varchar2(100),
    ORGU_CODE varchar2(100),
    TILL_SHORT_DESC varchar2(100),
    TXHD_TXN_NR integer
)

Can you provide your table create statement?

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top