I have this Oracle table which is used to store application settings.
This is the SQL script that it's used to create the table:
CREATE TABLE "GLOBALSETTINGS"(
"SettingName" Varchar2(40 ) NOT NULL,
"SettingValue" Varchar2(40 )
)
/
-- Add keys for table GLOBALSETTINGS
ALTER TABLE "GLOBALSETTINGS" ADD CONSTRAINT "Key14" PRIMARY KEY ("SettingName")
/
ALTER TABLE "GLOBALSETTINGS" ADD CONSTRAINT "SettingName" UNIQUE ("SettingName")
/
This is the SQL statement that I want to use:
UPDATE GLOBALSETTINGS
SET settingValue =
CASE
WHEN settingName = 'SessionTTL'
THEN '30'
WHEN settingName = 'MaxUsersActive'
THEN '40'
ELSE settingValue
END
WHERE settingName IN ('SessionTTL', 'MaxUsersActive');
But When I run it in SQL developer I get this error message:
Error starting at line 1 in command:
UPDATE GLOBALSETTINGS
SET settingValue = case
when settingName = 'SessionTTL' then '30'
when settingName = 'MaxUsersActive' then '40'
else settingValue
end
WHERE settingName in ('SessionTTL', 'MaxUsersActive')
Error at Command Line:7 Column:6
Error report:
SQL Error: ORA-00904: "SETTINGNAME": invalid identifier
00904. 00000 - "%s: invalid identifier"
*Cause:
*Action:
How I can fix the problem?
Best wishes Peter