Check parameter Value
=======================
SELECT * FROM V$PARAMETER
WHERE UPPER(NAME) LIKE '%UNDO%'
=======================
Create Database Link
=======================
CREATE DATABASE LINK my_link CONNECT TO user IDENTIFIED BY password USING 'connect_string';
=======================
DBMS_OUTPUT.PUT_LINE
=======================
To add empty line:
DBMS_OUTPUT.PUT_LINE(CHR(10));
=======================
Check Oracle Instance name.
=======================
SELECT * FROM V$INSTANCE
Or
SELECT * FROM GLOBAL_NAME;
=======================
Update multiple columns
=======================
UPDATE MY_TABLE
SET COL_1 = VAL_1,
COL_2 = VAL_2
WHERE COL_X = VAL_X;
=======================
Add Constraint
=======================
For Primary Key:
ALTER TABLE MY_TABLE ADD PRIMARY KEY (col_a,col_b);or
ALTER TABLE MY_TABLE ADD CONSTRAINT MY_TABLE_PK PRIMARY KEY (col_a,col_b);
For Unique Constraint:
ALTER TABLE MY_TABLE ADD CONSTRAINT MY_TABLE_UQ UNIQUE (col_a,col_b);
=======================
INSERT INTO FROM SELECT
=======================
To populate one table from another table
INSERT INTO TABLE_A(col1, col2, col3)
SELECT col1, col2, col3 FROM TABLE_B;
No comments:
Post a Comment