SELECT * FROM USER_CONSTRAINTS WHERE table_name ='ACCOUNT_STATEMENT' and constraint_name like 'CHK%';
Wednesday, 29 June 2011
fetch the contraint name from oracle table
SELECT * FROM USER_CONSTRAINTS WHERE table_name ='ACCOUNT_STATEMENT' and constraint_name like 'CHK%';
Friday, 24 June 2011
Tuesday, 21 June 2011
examples of Cursor FOR Loop in oracle
e.g.
SET SERVEROUTPUT ON
BEGIN
FOR trip_record IN (SELECT bt_id_pk, bt_duration
FROM business_trips) LOOP
-- implicit open/fetch occurs
IF trip_record.bt_duration = 1 THEN
DBMS_OUTPUT_LINE ('trip Number ' || trip_record.bt_id_pk
|| ' is a one day trip');
END IF;
END LOOP; -- implicit CLOSE occurs
END;
/
SET SERVEROUTPUT ON
BEGIN
FOR trip_record IN (SELECT bt_id_pk, bt_duration
FROM business_trips) LOOP
-- implicit open/fetch occurs
IF trip_record.bt_duration = 1 THEN
DBMS_OUTPUT_LINE ('trip Number ' || trip_record.bt_id_pk
|| ' is a one day trip');
END IF;
END LOOP; -- implicit CLOSE occurs
END;
/
Tuesday, 7 June 2011
Rename column in oracle
ALTER TABLE ACCOUNT_STATUS RENAME COLUMN delete_address_flag TO delete_history_flag;
Subscribe to:
Posts (Atom)