Tag Info

Hot answers tagged


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 ...


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 ...


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' ...


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);


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;


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


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/

Only top voted, non community-wiki answers of a minimum length are eligible