Tag Info

New answers tagged

5

Just call pg_database_size(dbname) to know the size of the database. VACUUM (without the FULL clause) does not free any space, it only marks it as reusable, and thus will not change the database's size (except in a rare boundary case, see Routine Vacuuming). ANALYZE does statistical sampling and would be useful if you needed the row counts, but for the ...


1

You can use setNull(): preparedStatement.setNull(8, Types.VARCHAR); Although I have seen drivers that do not properly support that, in that case simply try: preparedStatement.setString(8, null);


4

The common solution is to express this as: interval '1 day' * ? with ? as a placeholder for a numeric value (possibly with a fractional part). The syntax tried in the question is rejected because for the SQL grammar, the entire expression interval '1 day' is a constant. It cannot be changed by injecting a placeholder into it, just like we couldn't write ...


2

You can escape single quotes by using 2 single quotes, that way your query would work. I'm not sure about the java syntax for a replace but your query should look something like this SELECT COUNT(DISTINCT ROOT_ID) as rows1 FROM DANIEL.UNIQUE_PHYSICIAN WHERE UNIQUE_PHYSICIAN.SOURCE_TABLE = 'STI.PHYSICIAN' AND UNIQUE_PHYSICIAN.FIRST_NAME = 'JEANNE-D''ARC' ...


0

You can enable trace for you session after application is connected, for example, EXEC DBMS_MONITOR.session_trace_enable(binds=>TRUE);, then you will find the culprit in trace file. More information about tracing in Oracle https://oracle-base.com/articles/misc/sql-trace-10046-trcsess-and-tkprof


0

Either set tracing on client(jdbc) side. Or you can create system trigger ON SYSTEMERROR see this, but this requires DBA privs.


1

I managed to produce a working trigger based on ypercube's help. create or replace TRIGGER ROOT_PHYSICIAN_TRG BEFORE INSERT ON UNIQUE_PHYSICIAN REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW BEGIN IF INSERTING AND :NEW.is_root_phys = 1 THEN :NEW.root_id := :NEW.unique_id; END IF; END;


1

If you have a condition that specifies 1005 whether root_id has to get the same value as unique_id, you could use a TRIGGER. Something like this: CREATE OR REPLACE TRIGGER root_unique_trg BEFORE INSERT ON UNIQUE_PHYSICIAN FOR EACH ROW WHEN (NEW.is_root_phys = 1) BEGIN :NEW.root_id := :NEW.unique_id ; END ; Tested in SQLfiddle


1

It appears to be a bug in the way Squirrel handles additional parameters. Data Studio acts as expected with both db2jcc and db2jcc4 drivers. I have filed a bug to: https://sourceforge.net/p/squirrel-sql/bugs/1201/



Top 50 recent answers are included