1.How to display current Date & Time in Pl/Sql2.How to use DML in Procedure?

Questions by sairlen

Showing Answers 1 - 7 of 7 Answers

gomathi.e

  • Apr 7th, 2006
 

declare

xx date;

begin

select systdate into xx from dual;

dbms_ouput.put_line(xx);

end;

the IInd Questions is not understandable

  Was this answer useful?  Yes

vijaya

  • Apr 11th, 2006
 

if u want  to insert present time and date in a table

1) select sysdate into x from dual;

2) insert into sample_table(T_date) values(x);

select T_date from sample_table ;

 --- your present date and time will inserted.

DML statements can apply directly as above or through cursors.

  Was this answer useful?  Yes

pravin

  • Apr 26th, 2006
 

 Q2: -

create or replace procedure pro1(no emp.empno%type)

begin

update emp
set sal=sal+500
where empno=no;

end;

/

Q1. declare

xx date;

begin

select systdate into xx from dual;

dbms_ouput.put_line(xx);

pro1(7902);

end;

  Was this answer useful?  Yes

sankari

  • May 1st, 2006
 

If you give

SELECT sysdate from DUAL;

It will jus return the date alone.

To get the date with time

the following query will help.

select to_char(sysdate,'MM-DD-YYYY HH:Mi:SS') from dual;

Output

-------------

05-01-2006 12:41:48

 

  Was this answer useful?  Yes

Poonam

  • May 9th, 2006
 

Hi,

We can display the current date and time using PL\SQl in the below anonymous block....

declare
v_sysdate timestamp;
begin
select to_char(sysdate, 'DD-MON-YYYY HH:MM:SS') into v_sysdate from dual;
DBMS_OUTPUT.PUT_LINE(v_sysdate);
end;

Output:

-----------------------------------

09-MAY-06 02.05.01.000000 AM

  Was this answer useful?  Yes

vasu

  • Jun 28th, 2006
 

declare x timestamp;
begins
select localtimestamp into x from dual;
dbms_output.put_line(x);
end;

  Was this answer useful?  Yes

Sumeet Lalvani

  • Oct 30th, 2007
 

simple statement....
begin
select sysdate from into  A dual;
dbms_ouput.put_line(A);
end;

  Was this answer useful?  Yes

Give your answer:

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

 

Related Answered Questions

 

Related Open Questions