I'm trying to get the system date using the SYSDATE function in oracle, but I keep getting results equal to the number of rows in the table I'm requesting the system date from
Here how my code looks like:
SELECT TRUNC(SYSDATE)As Currnt_Time FROM TABLE_NAME
And this is my output:
enter image description here
The result is displaying the current time N times, I just want it to display it one time
SELECT TRUNC(SYSDATE)As Currnt_Time FROM dual;
DUAL only has 1 column, one row. So you'll get one answer.
You're asking to run a select on a table, so it will apply across all rows, unless you provide a predicate.
So you COULD do this, but don't.
select trunc(SYSDATE)as CURRNT_TIME from TABLE
where rownum < 2;
This will always be more expensive than using the DUAL table. That's why we built it, in fact.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With