What is the difference between precision and scale?
Precision 4, scale 2: 99.99 Precision 10, scale 0: 9999999999 Precision 8, scale 3: 99999.999 Precision 5, scale -3: 99999000
Precision 4, scale 2: 99.99 Precision 10, scale 0: 9999999999 Precision 8, scale 3: 99999.999 Precision 5, scale -3: 99999000
I believe it’s the ANSI standard. EDIT: Actually, I think it’s the SQL-92 standard. A later version of the standard appears to optionally allow for 128 character names, but Oracle doesn’t yet support this (or has partial support for it, insofar as it allows 30 characters. Hmmm.) Search for “F391, Long identifiers” on this page… … Read more
The referenced primary key is described in the columns r_owner and r_constraint_name of the table ALL_CONSTRAINTS. This will give you the info you want: SELECT a.table_name, a.column_name, a.constraint_name, c.owner, — referenced pk c.r_owner, c_pk.table_name r_table_name, c_pk.constraint_name r_pk FROM all_cons_columns a JOIN all_constraints c ON a.owner = c.owner AND a.constraint_name = c.constraint_name JOIN all_constraints c_pk ON … Read more
BEGIN FOR cur_rec IN (SELECT object_name, object_type FROM user_objects WHERE object_type IN (‘TABLE’, ‘VIEW’, ‘MATERIALIZED VIEW’, ‘PACKAGE’, ‘PROCEDURE’, ‘FUNCTION’, ‘SEQUENCE’, ‘SYNONYM’, ‘PACKAGE BODY’ )) LOOP BEGIN IF cur_rec.object_type=”TABLE” THEN EXECUTE IMMEDIATE ‘DROP ‘ || cur_rec.object_type || ‘ “‘ || cur_rec.object_name || ‘” CASCADE CONSTRAINTS’; ELSE EXECUTE IMMEDIATE ‘DROP ‘ || cur_rec.object_type || ‘ “‘ || … Read more
Use the V$SESSION view. V$SESSION displays session information for each current session.
You use the sql%rowcount variable. You need to call it straight after the statement which you need to find the affected row count for. For example: set serveroutput ON; DECLARE i NUMBER; BEGIN UPDATE employees SET status=”fired” WHERE name LIKE ‘%Bloggs’; i := SQL%rowcount; –note that assignment has to precede COMMIT COMMIT; dbms_output.Put_line(i); END;
99.9% of the time the error ORA-65096: invalid common user or role name means you are logged into the CDB when you should be logged into a PDB. For example, if you used the default 19c installation settings, you should login to ORCLPDB (the PDB) instead of ORCL (the CDB). DANGER – If you insist … Read more
To alter the password expiry policy for a certain user profile in Oracle first check which profile the user is using: select profile from DBA_USERS where username=”<username>”; Then you can change the limit to never expire using: alter profile <profile_name> limit password_life_time UNLIMITED; If you want to previously check the limit you may use: select … Read more
I fixed this issue by correcting my jdbc string. For example, the correct jdbc string should be… jdbc:oracle:thin:@myserver:1521/XE But the jdbs string I was using is … jdbc:oracle:thin:@myserver:1521:XE (Note: between 1521 and XE should be a /) This bad jdbc string give me a ORA-12505 error too.
In Oracle 12.2 and above the maximum object name length is 128 bytes. In Oracle 12.1 and below the maximum object name length is 30 bytes.