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
Does access use sql?
What is flag in sql?
What is pl/sql language case sensitive?
Can we use ddl commands in pl sql?
How do you select unique values in sql?
How do I truncate a sql log file?
How do I find duplicates in sql?
What is sql and db2?
Can a composite key be null?
How to start the command-line sql*plus?
what is 'mysqlimport'? : Sql dba
Explain the advantages and disadvantages of stored procedure?
How can you load multi line records? : aql loader
Suppose a student column has two columns, name and marks. How to get name and marks of the top three students.
What is difference sql and mysql?