Hi All,

I am new to both this blog and technology. I was able to
see a response for one of the questions on triggers as
below.

I would like to know why are we using
" if rtrim(to_char(sysdate,'day'))=rtrim('sunday') then"
instead, can't we use
" if sysdate = 'sunday' then".

I can understand the use of "rtrim", but dont know y v r
using to_char. I have seen this in many cases but did not
get a convincible explaination.

Please help me with this and do excuse if this question
sounds silly.

Thanks in advance......

create or replace trigger trg_sun
before insert on <table name>
begin
if rtrim(to_char(sysdate,'day'))=rtrim('sunday') then
raise_application_error(-20345,'no transaction in sunday');
end if;
end trg_sun;

Answer Posted / eshwer

Run this query and check the result you can easyly understand y we used trim function..

select length(to_char(sysdate,'day')), length(rtrim(to_char(sysdate,'day'))) from dual;

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does (+) mean in sql joins?

739


How to fix oracle error ora-00942: table or view does not exist

765


What are the basic sql commands?

747


How do you take the union of two tables in sql?

731


What does trigger mean in psychology?

708






What is inner join in sql?

774


Which are the different character-manipulation functions in sql?

719


What is raid? How does it help storage of databases?

798


what is auto increment? : Sql dba

743


What is foreign key and example?

705


What is cross join example?

736


Why indexing is needed?

729


How can we find duplicate records in a table?

664


What is forward declaration in pl sql?

758


What is partition in sql query?

721