It is bad manners to get a solution from a different forum and then post it here as yours. You should also probably acknowledge the people who helped you on the other forum.
I would very, very strongly advise you to endeavour to get the datatype of that column changed to a date. There is never a good reason to have a date stored as text in a database such as Oracle.
Maybe I'm missing something, but surely a simple analytic will do the job:
WITH T AS (
SELECT 'user a' usr, TO_DATE('9:00','HH:MI') tm, 'logged in' stat FROM DUAL UNION ALL
SELECT 'user a', TO_DATE('9:01','HH:MI'), 'logged in' FROM DUAL UNION ALL
SELECT 'user a', TO_DATE('9:02','HH:MI')...
1. I would doubt this (in either case of the code) as I'm pretty sure that BO won't accept aliasing in its dynamically created sql.
2. SYSDATE is a date, why would you use a to_date on it? Makes no sense whatsoever.
although, as Santa points out, your main issue seems to be with your brackets.
Only If those values are now text i.e. there was most likely a to_char performed on the value within the definition of the view. If they are not text, then they do not have trailing zeros.
Jim
Serves me right for not reading fully the question.
Answer number 1 is that the 'numbers' must be stored/passed as strings. storing/passing them as numbers will normalise the number and instantly become useless for anything with trailing zeros.
after that, a little bit of arithmetic (an...
Maybe a quick demo:
SQL> select to_char(7.5,'0')
2 from dual;
TO
--
8
SQL> ed
Wrote file afiedt.buf
1 select to_char(7.5,0)
2* from dual
SQL> /
TO
--
8
SQL> ed
Wrote file afiedt.buf
1 select to_char(7.5,'00')
2* from dual
SQL> /
TO_
---
08
SQL> ed
Wrote file afiedt.buf...
Maybe this'll help:
DROP TABLE foo;
CREATE TABLE foo (eg NUMBER, x NUMBER, y NUMBER, z NUMBER);
--Example 1
DECLARE
l_x NUMBER := 1;
l_y NUMBER := 2;
l_z NUMBER := 3;
l_str VARCHAR2(32767);
err_line EXCEPTION;
PRAGMA exception_init(err_line, -01008);
BEGIN
BEGIN
EXECUTE...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.