Home / Scripts (page 2)

Scripts

PL/SQL Code For Dropping All Objects in Schema

PL/SQL Code For Dropping All Objects in Schema   DECLARE v_itemcount INTEGER; BEGIN SELECT Count(*) INTO   v_itemcount FROM   all_objects AO WHERE  AO.owner = USER AND AO.object_type NOT IN ( ‘INDEX’ ) AND AO.object_name NOT LIKE ‘BIN$%’; WHILE ( v_itemcount > 0 ) LOOP FOR v_cmd IN (SELECT ‘drop ‘ || AO.object_type || ‘ ‘ || AO.object_name || Decode(AO.object_type, ‘TABLE’, ‘ CASCADE CONSTRAINTS’, ”) AS DROPCMD FROM   all_objects AO WHERE  AO.owner = USER AND AO.object_type NOT IN ( ‘INDEX’ ) AND AO.object_name NOT LIKE ‘BIN$%’) LOOP …

Read More »

PL/SQL Code for Counting Rows In Schema Tables

PL/SQL Code for Counting Rows In Schema Tables   DECLARE i INTEGER; BEGIN dbms_output.Put_line(‘Table Name,Row Count,’ || To_char(SYSDATE, ‘DD-MON-YYYY HH24:MI:SS’)); FOR v_table IN (SELECT ut.table_name FROM   user_tables ut) LOOP EXECUTE IMMEDIATE ‘select count(*) from ‘|| v_table.table_name INTO i; dbms_output.Put_line(v_table.table_name || ‘,’ || To_char(i)); END LOOP; END;    

Read More »

Concurrent Request Queries

Concurrent Request Queries   HISTORY OF CONCURRENT REQUEST  (PROGRAM WISE)   SELECT DISTINCT t.user_concurrent_program_name, r.request_id, To_char(r.actual_start_date, ‘dd-mm-yy hh24:mi:ss’) “Started at”, To_char(r.actual_completion_date, ‘dd-mm-yy hh24:mi:ss’) “Completed at”, Decode(r.phase_code, ‘C’, ‘Completed’, ‘I’, ‘Inactive’, ‘P ‘, ‘Pending’, ‘R’, ‘Running’, ‘NA’) phasecode, Decode(r.status_code, ‘A’, ‘Waiting’, ‘B’, ‘Resuming’, ‘C’, ‘Normal’, ‘D’, ‘Cancelled’, ‘E’, ‘Error’, ‘F’, ‘Scheduled’, ‘G’, ‘Warning’, ‘H’, ‘On Hold’, ‘I’, ‘Normal’, ‘M’, ‘No Manager’, …

Read More »

Find the Org and Organization mappings

configure

  SELECT   ood.organization_code Warehouse_code,   ood.organization_name Warehouse,   ood.operating_unit OU_ID,   hou.name OU_Name,   hle.name Legal_entity,   hle.set_of_books_id,   gsob.name SOB FROM   org_organization_definitions ood,   hr_operating_units hou,   hr_legal_entities hle,   gl_sets_of_books gsob WHERE …

Read More »