Is there any boolean type in Oracle databases?

Not only is the boolean datatype missing in Oracle’s SQL (not PL/SQL), but they also have no clear recommendation about what to use instead. See this thread on asktom. From recommending CHAR(1) ‘Y”https://stackoverflow.com/”N’ they switch to NUMBER(1) 0/1 when someone points out that ‘Y”https://stackoverflow.com/”N’ depends on the English language, while e.g. German programmers might use … Read more

Best way to do multi-row insert in Oracle?

In Oracle, to insert multiple rows into table t with columns col1, col2 and col3 you can use the following syntax: INSERT ALL INTO t (col1, col2, col3) VALUES (‘val1_1’, ‘val1_2’, ‘val1_3’) INTO t (col1, col2, col3) VALUES (‘val2_1’, ‘val2_2’, ‘val2_3’) INTO t (col1, col2, col3) VALUES (‘val3_1’, ‘val3_2’, ‘val3_3’) . . . SELECT 1 … Read more

Update statement with inner join on Oracle

That syntax isn’t valid in Oracle. You can do this: UPDATE table1 SET table1.value = (SELECT table2.CODE FROM table2 WHERE table1.value = table2.DESC) WHERE table1.UPDATETYPE=’blah’ AND EXISTS (SELECT table2.CODE FROM table2 WHERE table1.value = table2.DESC); Or you might be able to do this: UPDATE (SELECT table1.value as OLD, table2.CODE as NEW FROM table1 INNER JOIN … Read more

Liquibase lock – reasons?

Sometimes if the update application is abruptly stopped, then the lock remains stuck. Then running UPDATE DATABASECHANGELOGLOCK SET LOCKED=0, LOCKGRANTED=null, LOCKEDBY=null where ID=1; against the database helps. You may also need to replace LOCKED=0 with LOCKED=FALSE. Or you can simply drop the DATABASECHANGELOGLOCK table, it will be recreated.

Oracle: If Table Exists

The best and most efficient way is to catch the “table not found” exception: this avoids the overhead of checking if the table exists twice; and doesn’t suffer from the problem that if the DROP fails for some other reason (that might be important) the exception is still raised to the caller: BEGIN EXECUTE IMMEDIATE … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)