Re: create view with null column

From: Mark C. Stock <mcstockX_at_Xenquery>
Date: Fri, 16 Apr 2004 21:55:39 -0400
Message-ID: <>

"Malcolm Dew-Jones" <> wrote in message
| I wish to create a view where one column is always null but has a width.
| (The view is to temporarily mimic a table where that happens to be true).
| The technique I used was (e.g.)
| decode(other_column,'its_never_this_value','xxx','') "allways_null"
| which produces a column of varchar(3) but the value is always null.
| However this depends on using another column in the table, and depends on
| that other column never having the indicated value.
| I tried various combinations of functions with a constant, but then oracle
| knows that the value is always going to be null and I don't get a column
| with.
| I wonder if there is some simpler, cleaner way to do this.

SQL> create or replace view nulltestview as   2 select
  3 empno
  4 , decode('0000',to_char(sysdate,'YYYY'),'xxx',null) trythis   5 from
  6 emp;

;-{ mcs Received on Sat Apr 17 2004 - 03:55:39 CEST

Original text of this message