Tuesday, 30 October 2012

executing PL/SQL code in TOAD

DECLARE
  P_ST VARCHAR2(200);
  P_PRODUCT VARCHAR2(200);
  P_QUANTITY NUMBER;

BEGIN
  P_ST := 'WA';
  P_PRODUCT := NULL;
  P_QUANTITY := NULL;

  SP_GET_INVENTORY ( P_ST, P_PRODUCT, P_QUANTITY );
  COMMIT;
END;

Wednesday, 24 October 2012

Oracle Query to list the invalid objects and recompile the invalid objects

Query to List Invalid objects


select
owner ,object_type ,object_name from dba_objects where status != 'valid' and object_type <> 'synonym' and owner='slam' order by owner, object_type ;



 Query to recompile the invalid objects:

 
select 'alter ' || object_type || ' ' || owner || '.' || object_name || ' compile;' from dba_objects where lower(status) = 'invalid' and lower(owner)='slam';

Tuesday, 23 October 2012

Query Oracle Invalid Objects

Query Oracle Invalid objects
 
 
SELECT owner ,object_type ,object_name FROM dba_objects
WHERE status != 'VALID' order by owner, object_type ;
Recompile Oracle
SELECT 'ALTER ' || OBJECT_TYPE || ' ' || OWNER || '.' || OBJECT_NAME || ' COMPILE;'
FROM dba_objects where status = 'INVALID' and owner='SCOTT';

Savitha Shinto: converting a number to time stamp

Savitha Shinto: converting a number to time stamp: select trunc(sysdate) + 84736 / 86400 from dual