This is used to create an Oracle 10g Database table using another existing Oracle 10g Database table:
- SQL> create table TIME_DIM_NEW AS (SELECT * from TIME_DIM WHERE MONTH='srikanth');
This is used to retrieve the count of all DISTINCT date rows(in the format dd/mm/rrrr) after stripping out the "time:secs" information from the CREATED_DATE field:
- SQL> SELECT count(DISTINCT to_date(CREATED_DATE, 'dd/mm/rrrr')) FROM CONTRACT_DASHBOARD;
This is used to get a range of values from the select statement using ROWNUM Oracle 10g Database:
- SELECT name, price FROM items WHERE ROWNUM > 5 and ROWNUM < 20 ;
This is used to get the Current Date from the Oracle 10g Database:
- select sysdate from dual;
Output:
---------
27-MAY-02
This is used to get the Current User in the Oracle 10g Database:
- select user from dual;
USER
------------------------------
SCOTT
This is used to get all the rows that has NO words, numbers and underscores in the Oracle 10g Database:
SQL> SELECT cust_name FROM sales WHERE REGEXP_LIKE (cust_name, '
[^[:alnum:]_]
');OR
SQL> SELECT cust_name FROM sales WHERE REGEXP_LIKE (cust_name, '
[\W]
');This is used export and import tables from an Oracle 10g database instance to another Oracle 10g database instance:
This is used to export and import only few tables in the schema ORCL.
- exp USERID=srikuser/srikpassword@ORCL TABLES=(BUS_ORG_DIM, CONTRACT_DIM, CONTRACT_FACT, PRODUCT_DIM, REGION_DIM, TIME_DIM) FILE=obieetab.dmp
- imp USERID=newuser/newpassword@ORCLDD TABLES=(BUS_ORG_DIM, CONTRACT_DIM, CONTRACT_FACT, PRODUCT_DIM, REGION_DIM, TIME_DIM) IGNORE=Y FILE=obieetab.dmp
This is used to export and import all the tables in the schema ORCL.
- exp srikuser/srikpassword@ORCL FILE=mototabs.dmp
- imp newuser/newpassword@ORCLDD FILE=mototabs.dmp
This "SQL Copy" is used to copy tables from one Oracle Database 10g Schema to another Oracle Datbase 10g Schema:
- SQL> create user srikuser identified by srikpwd default tablespace users;
- SQL> grant connect,resource to srikuser;
- copy FROM servstg/servpasswd@ORCL TO srikuser/srikpwd@ORCLNW CREATE BUS_ORG_DIM USING SELECT * FROM BUS_ORG_DIM
- copy FROM servstg/servpasswd@ORCL TO srikuser/srikpwd@ORCLNW CREATE CONTRACT_DIM USING SELECT * FROM CONTRACT_DIM
- copy FROM servstg/servpasswd4@ORCL TO srikuser/srikpwd@ORCLNW CREATE CONTRACT_FACT USING SELECT * FROM CONTRACT_FACT
- copy FROM servstg/servpasswd@ORCL TO srikuser/srikpwd@ORCLNW CREATE PRODUCT_DIM USING SELECT * FROM PRODUCT_DIM
- copy FROM servstg/servpasswd@ORCL TO srikuser/srikpwd@ORCLNW CREATE REGION_DIM USING SELECT * FROM REGION_DIM
- copy FROM servstg/servpasswd@ORCL TO srikuser/srikpwd@ORCLNW CREATE TIME_DIM USING SELECT * FROM TIME_DIM
No comments:
Post a Comment