When you need to copy data from the Toad Data grid, CTRL+V will not copy the column headers. If you need the Column headers to be copied, press CTRL+INSERT to copy the headers as well.
google analytics
meta
adsense
Showing posts with label oracle. Show all posts
Showing posts with label oracle. Show all posts
Thursday, March 22, 2012
Tuesday, March 6, 2012
SQL to get the Next or previous Weekend Date - NEXT_DAY
The below SQL gives the next Saturday and the next Sunday dates.
SELECT NEXT_DAY('06-MAR-2012', 'SATURDAY') "next saturday"
,NEXT_DAY('06-MAR-2012', 'SUNDAY') "next sunday"
FROM dual;
If the requirement is to find the previous weekend dates, just subtract the dates by 7.
SELECT NEXT_DAY('06-MAR-2012', 'SATURDAY')-7 "next saturday"
,NEXT_DAY('06-MAR-2012', 'SUNDAY')-7 "next sunday"
FROM dual;
SELECT NEXT_DAY('06-MAR-2012', 'SATURDAY') "next saturday"
,NEXT_DAY('06-MAR-2012', 'SUNDAY') "next sunday"
FROM dual;
If the requirement is to find the previous weekend dates, just subtract the dates by 7.
SELECT NEXT_DAY('06-MAR-2012', 'SATURDAY')-7 "next saturday"
,NEXT_DAY('06-MAR-2012', 'SUNDAY')-7 "next sunday"
FROM dual;
Thursday, August 18, 2011
Oracle - Fetching all columns for a given table or finding all table which has a column name
The below query will help you in situations when you want to dynamically fetch the columns for a specific table or when you simply need the list of all tables which have a column like you are looking for.
SELECT OWNER,
TABLE_NAME,
COLUMN_NAME,
DATA_TYPE,
DATA_LENGTH,
DATA_PRECISION,
NULLABLE,
LAST_ANALYZED,
CHAR_USED,
HISTOGRAM
FROM all_tab_columns
Oracle - List all available DB links in the database
List all available DB links in the database:
SELECT * FROM dba_db_links
SELECT * FROM dba_db_links
Subscribe to:
Posts (Atom)
