GeekInterview.com
Series: Subject:
Question: 48 of 196

how to take DATE as user input in PL/SQL block?

Asked by: NIKKI_PRIYAL | Member Since Jul-2008 | Asked on: Jul 19th, 2008

View all questions by NIKKI_PRIYAL

Showing Answers 1 - 2 of 2 Answers

create or replace function get_period (pDate varchar2) return varchar2is pday varchar(20);begin SELECT TO_CHAR(to_date('&DATE','MM/DD/YYYY'),'DAY') into pday FROM DUAL;return pday;end get_period;to call the function select get_period(08/03/2008) from dual;

  
Login to rate this answer.

Inputting the date in PL/SQL is same as in SQL. Simply pass the date as a string in the format DD-MON-YYYY.

Eg: SELECT * FROM TABLE WHERE HIRE_DATE='dd-mon-yyyy'.

Or

You can also use Date functions TO_DATE('25-aug-2008','......date formate......');

Hope this is the answer, you are looking for.

Raghu.

  
Login to rate this answer.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.