I want to generate an output with blank/empty column with a "Select" query in oracle. I'm able to achieve this with below sql query:
SELECT CustomerName AS Customer, "" AS Contact FROM Customers;
So when I run above sql query it returns a table with two columns "Customer" column with content in it and "Contact" column with no content or blank column. I want to achieve same with oracle query. Any help will be highly appreciated.
In this article, we will look into how you can set the column value to Null in SQL. update students set Gender = NULL where Gender='F'; SELECT * FROM students ; Output: Column value can also be set to NULL without specifying the 'where' condition.
I think you should use null
SELECT CustomerName AS Customer, null AS Contact FROM Customers;
And Remember that Oracle
treats a character value with a length of zero as null.
In DB2, using single quotes instead of your double quotes will work. So that could translate the same in Oracle..
SELECT CustomerName AS Customer, '' AS Contact FROM Customers;
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