-
To_date
Hi
I have a problem with cross-impact TO_DATE function and column name.
In table TAB_A is a column with name "TO_DATE" and I would like to use TO_DATE function by selecting from this table in PL/SQL block.
BEGIN
SELECT ..., TO_DATE(NULL,'dd.mm.yyyy'), ... FROM tab_a
UNION ALL
SELECT ..., date_column, ... FROM tab_b;
END;
-- in this case pl/sql compilation failed, because of bad table column using
BEGIN
SELECT ..., STANDARD.TO_DATE(NULL,'dd.mm.yyyy'), ... FROM tab_a
UNION ALL
SELECT ..., date_column, ... FROM tab_b;
END;
-- in this case pl/sql compilation is ok, but when pl/sql is running, the following error is returned -> "invalid column name"
Pls. don't tell me, why i've created a column with that name... I haven't, it has been existed.
-
Hi,
How about giving a Column Alias, Wud it work ?
SS
-
Oracle 8i
It is Oracle 8i (I've forgotten to write it)
-
Alias ?
I don't know what do you mean with column alias ?
.., to_date(..) as alias_name, ..
??
-
Hi,
select to_date as TODAYS_DATE from EMP;
Does the above works in 8i or not.
SS
-
of course
yes it works... but i still don't know how can alias help me in this problem...
-
hey i tried the below thing and it works fine for me..
create table abc1(to_date date);
insert into abc1 values (to_date('10/01/04','dd/mm/rr'))
select to_date(to_date,'dd/mm/rrrr') as new_date from abc1
I m not sure whether i m understanding the problem correctly or not
SS
-
probalby not :)
of course it is working like you have written...
but when it is in PL/SQL block and you use statement with union all... i don't know why it doesn't work...
-
try it
try to run this
begin
select to_date(to_date,'dd/mm/rrrr') as new_date from abc1;
end;
-
Why do u want to do that,,,unless u want to store it in a variable or open a cursor.
dont u thin u shuld have a INTO clause.
do u get me?
SS
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|