Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

oracle create index if not exists

DECLARE
    already_exists EXCEPTION;
    columns_indexed EXCEPTION;
    PRAGMA EXCEPTION_INIT ( already_exists, -955 );
    PRAGMA EXCEPTION_INIT (columns_indexed, -1408);
BEGIN
    EXECUTE IMMEDIATE 'CREATE INDEX ord_customer_ix ON orders (customer_id)';
    dbms_output.put_line('created');
EXCEPTION
    WHEN already_exists OR columns_indexed THEN
        dbms_output.put_line('skipped');
END;    
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #oracle #create #index #exists
ADD COMMENT
Topic
Name
6+2 =