select year from dual oracle 1

select year from dual oracle

select to_char(sysdate, 'YYYY') from dual;

Here is what the above code is Doing:
1. We’re using the `cursor` object to execute a SQL query.
2. The SQL query is a string that is passed to the `execute` method.
3. The `execute` method returns a list of tuples.
4. We’re using a list comprehension to extract the first element of each tuple.
5. We’re using the `join` method to concatenate the elements of the list into a string.
6. We’re using the `print` function to display the string.

Let’s try another example.

Similar Posts