Oracle SQL & PL/SQL Quick Notes

Hi Guys, We come across few queries in oracle and pl/sql on daily development tasks which we forget/wont remember correctly sometime. This post keeps track on those items. Keep visiting this post for the regular updates.   This can be used to refresh for your oracle and pl/sql interviews as well. Feel free to add your thoughts in the comments

101 total views, 2 views today

» Read more

How to Insert Single and Double Quotes in Oracle?

How to Insert Single and Double Quotes in Oracle? Inserting Single quote in oracle: If your query is like this, insert into emp (id,name,salary) values (10,’Naveen’s’,10000); // error then you will get the error for the single quote in the name. We have to escape it to insert in oracle using one more single quote like this, insert into emp

214 total views, 1 views today

» Read more

select with timestamp or date in oracle

select with timestamp or date in oracle: If you want to select the date field or timestamp field with the given date, then you have to use the query like this, select * from TABLE_NAME where TO_CHAR(TIMESTAMP_OR_DATE_COLUMN,’DD-MM-YYYY’) =’25-02-2014′; Eg: select * from POST_SITE where TO_CHAR(POST_TMS,’DD-MM-YYYY’) =’25-02-2014′; here POST_SITE is the name of the table and POST_TMS is the name of

197 total views, 2 views today

» Read more

LISTAGG EXAMPLE IN ORACLE

LISTAGG EXAMPLE IN ORACLE: LISTAGG can be used to get all the row values in single row. Example: [STUDENT_TABLE] Student_id Student_Name Course_id 1                   Naveen                A100 2                   Hems                  A130 3                   Chudar               A100 4                   Balaji                  A100 5                  Aravind                A120 6                   RVS                    A130 7                    JP                      A130 8                    Arun                   A120 9                  K Aravind             A100 Now you want to get the result with respect

226 total views, 2 views today

» Read more

Oracle Date Formats examples

The below are the mostly used oracle date formats: MM/DD/YYYY HH.MI.SS – 01/23/2014 08.41.56 MM/DD/YYYY HH24.MI.SSFF – 01/23/2014 08.41.56066000 MM/DD/YYYY HH24.MI.SSXFF – 01/23/2014 08.41.56.066000 MM/DD/YYYY HH24:MI:SS AM – 01/23/2014 08:41:56 AM MM/DD/YYYY HH24:MI:SS PM – 01/23/2014 08:41:56 AM Please add if you know any other oracle date formats in the comments area. 163 total views, no views today

163 total views, no views today

» Read more

Difference Between to_char and to_date with example

to_char: to_char converts a date to string. Query: Select to_char(sysdate) from dual; Output: 25-NOV-13 Query: Select to_char(sysdate,’DD-MM-YYYY’) from dual; Output: 25-11-2013 to_date: to_date converts a string to date. Query: Select to_date(sysdate) from dual; Output: 25-NOV-13 Query: Select to_date(sysdate,’DD-MM-YYYY’) from dual; Output: 25-NOV-13 204 total views, 1 views today

204 total views, 1 views today

» Read more
1 2