create a view, the default value of the columns are NULL

Windows XP / 10g 10.2.0.1.0

I have a table tab1 (test1, test2, test3)

And, I have to create a view as:
create or replace VW1 (test1, test2, viewtest1, viewtest2) as (select test1, test2, viewtest1, viewtest2 from tab1, double);

And need to viewtest1 and viewtest2 to be default null value column.

Thank you.

You are looking for something like this?

create or replace VIEW VW1(test1, test2, viewtest1, viewtest2) as
         (select test1, test2, NULL, NULL from tab1);

Tags: Database

Similar Questions

  • function to set a default value for a column that is defined by the user

    Hi all

    Can use us the user-defined function to set a default value for a column?

    for example:
    create or replace  function test1  return number is
    begin 
    return 10;
    end;
    
    
    create table testt
     (id  as test1,
      name varchar2(20));
    
    error:
    ORA-02000: missing ( keyword
    Thank you
    Ashwani

    Ashwani says:

    Can use us the user-defined function to set a default value for a column?

    N °

    A trigger (this function call) can be used to implement such a feature.

  • How to set the default value of a column from the value of the 2 columns given

    Is it possible to set the default value for a column A, as the concatenated values of columns B and C of the create table statement itself without using the trigger.

    for example, in a line, if column B is 'James' and column C is "smith" then the column has must be "james Smith".
    in another line if column B is 'Bob' and column C is "Taylor" then column should be "Bob Taylor"

    Thank you
    YG

    Yes, it is possible. But what is your version of the database? Try to use "virtual column. Search for a virtual column in the following link.
    http://www.Oracle.com/technology/pub/articles/Oracle-database-11g-top-features/11g-schemamanagement.html
    http://download.Oracle.com/docs/CD/B28359_01/server.111/b28286/statements_7002.htm

  • How to use the default value of a column in a table in insert or upda

    Hello

    I try to use the values by default so that the user should not have to enter data, but when I select default type and a default, I see an error message if I try to add a new line.

    How can I use a default value to a column in a tabular presentation?

    Gouri

    Published by: user1046395 on April 3, 2009 09:58

    Gouri,

    You can change simply to attribute each report column. For example,.

    To set the default date.
    Default type: PL/SQL Expression of function
    Default: sysdate

    To set the default text,
    Default type: PL/SQL Expression of function
    Default: * "CLERK."

    If you still get an error, what is the error message?
    Tarraf

  • Change the default value of some columns in an oracle 11g table

    I have a table called cust_file, its table consists of a large number of columns (one of these columns called cus_tax) and have a lot of data.

    I use oracle 11g, I want to change the default value of the column cus_tax is equal 1.

    I wrote

    ALTER TABLE cust_file MODIFY (1 by DEFAULT cus_tax).


    Table changed


    but after I inserted new data to test the operation, I found that the new record has a value = null for the column cus_tax


    then I tested it using the following query


    Select data_default in the all_tab_columns where table_name = 'CUST_FILE' and column_name = 'CUS_TAX ';

    no selected line


    so please help me to change the default value of the cus_tax column.



    Thanks for any help.



    > but after I inserted new data to test the operation, I found that the new record has a value = null for the column cus_tax

    If the INSERT included a NULL value for the column, the GET of a NULL inserted by default substitution.

    SQL > create table hkc_test_10 (id_column number, data_col_1 varchar2 (5), data_col_2 varchar (5));

    Table created.

    SQL > insert into hkc_test_10 values (1, 'First', 'F');

    1 line of creation.

    SQL > select * from hkc_test_10 by 1.

    ID_COLUMN DATA_ DATA_
    ---------- ----- -----
    1 first F

    1 selected line.

    SQL > alter table hkc_test_10 change (data_col_2 default 'TRUE');

    Modified table.

    SQL > insert into hkc_test_10 values (2, 'Second', NULL);

    1 line of creation.

    SQL > select * from hkc_test_10 by 1.

    ID_COLUMN DATA_ DATA_
    ---------- ----- -----
    1 first F
    2 second

    2 selected lines.

    SQL > insert into hkc_test_10 (id_column, data_col_1) values (3, 'Third');

    1 line of creation.

    SQL > select * from hkc_test_10 by 1.

    ID_COLUMN DATA_ DATA_
    ---------- ----- -----
    1 first F
    2 second
    3 third TRUE

    3 selected lines.

    SQL >

    Hemant K Collette

  • How to set the default value of a column?

    Hello
    While creating a table a lack that certain field value is set to a default value, like:

    create table t2
    (a number;
    b number not null);

    In this table, I want to put a value to a certain default value, as in the case where a value is not entered then a field will be automatically filled with the default value. How to do this?

    Very simple:

    create table t2
    (a number default 10,
    b number not null);
    

    You can also set a default value and keep it as NOT NULL, to prevent it from being updated with NULL value later.

    create table t2
    (a number default 10 not null,
    b number not null);
    

    You can probably get faster answers glancing http://tahiti.oracle.com/ to more simple questions, in which case you would be looking for.

    Kind regards
    Francisco.

  • The columns are created whenever I try to add a page of my document.

    Hi all

    I've been using InDesign for a good two weeks so I defenses if this is obvious.  I would like to say that I have been all over Google and have not found something that addresses my problem.

    I'm creating my school Yearbook in InDesign. Whevever I insert a new page in the document, the rest of the pages are reformatted with columns. This only happens when I insert a page at the end of the document, just at the moment where they affect other pages.

    1. prior to inserting a page:

    Screen Shot 2013-05-28 at 7.14.49 PM.png

    2. when I insert a pageL

    Screen Shot 2013-05-28 at 7.16.03 PM.png

    This happens oll of over 100 pages in the document, before and after the page that I inserted.

    Thanks for any help.

    -Ari

    PS It's really urgent. I know this does not help, but I don't have that two days to finish this book and this problem it will be difficult for me to do any other work on the document.

    Don't really "solve you" the problem, avoid you it by only adding pages in pairs. Alternatively, you can override master items again and remove them, but it's a true paiin when they are behind the other things (and masters objeccts are always behind the non-maitre objects on any given layer).

    And you're not really see two columns. What you have is two blocks of text on top of the other, a text aligned left and right aligned text.

  • View the columns in your report based on the command prompt

    Hello gurus,

    I have a report (pivot View) with the following dimensions and facts

    1 country (Dimension)
    2. the dealer group (Dimension)
    3. name (Dimension) of the region from the sale of parts
    4. parts name (Dimension) sales representative
    5 dealer account (Dimension)
    6 heart FY purchases (Fact)
    7. purchases of fiscal Prv (Fact)
    8% change (Fact)

    I have all the dimensions of filters (as guest)

    The requirement is now
    When I select the country from the prompt and click on go. the report is expected to show only dealer group and measures 3.
    When I choose the dealer group from the prompt and press go. the report should appears with the name of parts sales region and the corresponsing measures

    So I intend to use the command prompt to display the columns according to me

    from now my report shows the entire column irrespective of what I select in the command prompt. (such as the report displays all my dimensions and facts). I should be able to restrict the column in the reprot based on what the user, select the prompt for

    Is this possible?

    Appreciate your thoughts.

    Published by: 872290 on July 13, 2011 10:04

    Read my response here:

    Re: How to add new columns by using the multiple selection

  • How to assign the text value when the data in the column is null or empty

    Hello guys

    I have a small question

    I have a column A that half of its value is empty, now the condition is that whenever the column is empty, assign "N/a" in the column... So I wrote a code which is:

    <? If: not (column A)? > column a = 'n/a' <? end if? >

    However, when I preview the RTF model, the data in the column still has not changed at all, many lines are still empty and did not show 'n/a '... The column is of type text

    Please advice

    Thank you
    N/A
    
  • How to view the column 'A' in e-mail files

    Is it possible to get TB to display the 'To' column in my "sent"?

    Try to use the column 'recipient '.

    TB - 38, 3 Win10-PC

  • How to view the columns (and the sequence and sort order) an index?

    Suppose I have an INDEX for an existing TABLE.

    How can I know the columns covered by this INDEX (and the sequence and sort order)?

    Which table contains this information?

    ALL_INDEXES does not work.

    Peter

    user559463 wrote:
    Suppose I have an INDEX for an existing TABLE.

    How can I know the columns covered by this INDEX (and the sequence and sort order)?

    Which table contains this information?

    ALL_INDEXES does not work.

    Peter

    --

    Select the table table_name, column_name, index_name, and position_colonne
    of user_ind_columns
    order by table_name, index_name, position_colonne;

  • Adding a sequence as a default value for a column in a table field

    Hi all

    APEX 4.2.4. Oracle XE 11.2

    I'm trying to add a default value from a sequence to a column in a table field, so he fills when I hit the "Add Row" button...

    The reason for this by the way, rather than simply using a sequence database and the trigger on the column (which exists and works very well), is that I try also add detail records to the line when I create, and I can not, I do not have the ID of the parent to the child records.

    Looking at the docs, (for example oracle 11 g pl/sql enhancements), I thought I'd have be able to use a PL/SQL expression as to_char (petty_cash_seq. NEXTVAL) or to_number (petty_cash_seq. NEXTVAL) or all that kind of expression that extracts the sequence.nextval, as it became available in PL/SQL on the database

    so, Ive tried

    TO_CHAR (petty_cash_seq. NEXTVAL) in tabular form attributes - column default / PL/SQL expression and he said ORA-02287: unauthorized number sequence here...

    Ive also tried rolling upward in a PL/SQL package, as below:

    DECLARE v_seq_value NUMBER; BEGIN select petty_cash_seq. NEXTVAL in the double v_seq_value; return v_seq_value; END;

    and I get ORA-00923: KEYWORD not found where expected.

    Can anyone help as to why neither of them do not seem to work as an expression / packages in the default type?

    or... a simple alternative to get the ID of the next record when I hit 'Add Row' before I can create child folders at the same time...

    And I've been mulling over the merits of the master / detail integrity and try to think in an orderly manner to create the mask, add the details without having to first submit the master, then go back and go into details... And put it into context, its a request for costs where users create an expense entry and download copies of their expenses at the same time...

    Thank you very much

    Richard

    Use a combination of AJAX and JavaScript to get the next value in the sequence in a version substituted the line Add.

    1. on the page editor, right-click on the Ajax callbacks and select Create.

    2. on the next page, select PL/SQL. Do * not * select the tabular presentation. Leave this field blank.

    3. name your process, e.g. getNextSequence

    4. Add the code (under the DIRECTION of your own names of the object):

    DECLARE
        ln_NextSequence NUMBER := 0;
    BEGIN
        SELECT MY_SEQUENCE.NEXTVAL
        INTO ln_NextSequence
        FROM DUAL;
    
        HTP.P(TO_CHAR(ln_NextSequence));
    END;
    

    5. When you look now, you will see that the button Add a line called javascript:addRow (). Remove all this and change the button to be triggered by a dynamic action.

    6. create a dynamic action when a click on your button to add a line

    7. Add the following JavaScript code to get the new value of the sequence using your AJAX call from above and then place it on the newly added line:

    var nextSequenceID;
    
    apex.server.process(   'getNextSequence'
                         , {}
                         , { dataType: "text",
                             async: false,
                             complete: function( ajaxResponse )
                                      {
                                        nextSequenceID = ajaxResponse.responseText;
                                      }
                           });
    
    addRow();
    
    $('td [headers="YOUR_ID_COLUMN_NAME_HERE"] input:last').val(nextSequenceID);
    

    -Joe

  • Specify a default value for a column in a Script

    Greetings fellow Forum inhabitants,

    Thank you in advance for taking the time to read and answer my post! (thumbs up)

    I'll jump in full.

    I've already created table:

    CREATE TABLE Bill

    (

    OrdID number 4 NOT NULL,

    Description VARCHAR2 (30) NOT NULL,

    ProdID NUMBER (6)

    actualprice NUMBER (8.2)

    NUMBER Qty. (8).

    itemtot NUMBER (8.2)

    );.

    I have to create a script to load the rows in the table of the invoice by the intervention of the user. However, I specify a default value for quantity

    That's what I have so far:

    INSERT INTO Bill (ordid, description, prodid, actualprice, qty, itemtot)

    VALUES (& & ordid, & & description, & & prodid, & & actualprice, by DEFAULT, & & itemtot)

    WHERE qty = DEFAULT;.

    or

    WHERE DEFAULT = 1;

    or

    ??

    I don't know where I am going wrong. I apologize if I'm unable to communicate what she I'm actually doing.

    Any advice would be appreciated.

    Thanks again for your time.

    Hello

    e752a7a0-bab5-4ee4-9ea4-bf7c4a2cadab wrote:

    Greetings fellow Forum inhabitants,

    Thank you in advance for taking the time to read and answer my post! (thumbs up)

    I'll jump in full.

    I've already created table:

    CREATE TABLE Bill

    (

    OrdID number 4 NOT NULL,

    Description VARCHAR2 (30) NOT NULL,

    ProdID NUMBER (6)

    actualprice NUMBER (8.2)

    NUMBER Qty. (8).

    itemtot NUMBER (8.2)

    );.

    I have to create a script to load the rows in the table of the invoice by the intervention of the user. However, I specify a default value for quantity

    That's what I have so far:

    INSERT INTO Bill (ordid, description, prodid, actualprice, qty, itemtot)

    VALUES (& ordid, & description, & prodid, & actualprice, by DEFAULT, & itemtot)

    WHERE qty = DEFAULT;.

    or

    WHERE DEFAULT = 1;

    or

    ??

    I don't know where I am going wrong. I apologize if I'm unable to communicate what she I'm actually doing.

    Any advice would be appreciated.

    Thanks again for your time.

    Sorry, I can't understand what you want.

    If you want the production order 1, then put a literal 1 for the value of this column:

    INSERT INTO Bill (ordid, description, prodid, actualprice, qty, itemtot)

    VALUES (& ordid, ' & description', & prodid, & actualprice, 1, & itemtot)

    ;

    or, if that value is used elsewhere in your script, set a variable substitution:

    DEFINE Qty = 1

    INSERT INTO Bill (ordid, description, prodid, actualprice, qty, itemtot)

    VALUES (& ordid, ' & description', & prodid, & actualprice, & qty, & itemtot)

    ;

    I hope that answers your question.

    If this isn't the case, post an example, such as:

    "If the user types... then the created line must contain... but if the user types... then the new line should be... »

    Simplify the question.  Do you really need 6 columns to show what you don't understand?  Why not just 2 or 3 columns?

    See the FAQ forum: https://forums.oracle.com/message/9362002

  • SELECT where the column is NULL or a number

    Hello

    I am trying to use a query that the WHERE clause contains a column that can be NULL or a number. If it contains a number, I want to select the rows that contain the numerical value for this column; Otherwise, the rows that contain NULL for this column, as shown here:

    SELECT col_1,
    col_2,
    etc...
    OF CN_BGT_ENTRIES
    WHERE grnt_id = p_grnt_id

    AND subbgt_nbr = (SELECT MAX (subbgt_nbr) FROM CN_BGT_ENTRIES WHERE grnt_id = p_grnt_id);

    in the opposite case

    AND subbgt_nbr is null;

    My strategy has been to create a cursor, EXTRACT the max value in l_subbgt_max and then use a BOX of the form:

    SELECT col_1,
    col_2,
    etc...
    OF CN_BGT_ENTRIES
    WHERE grnt_id = p_grnt_id
    AND (CASE
    WHEN l_subbgt_max IS NULL THEN ' subbgt_nbr IS NULL; "
    ELSE ' subbgt_nbr = l_subbgt_max; »
    (END);

    I tried every syntax since I can think of (for example, CASE NVL(l_subbgt_max,0) = 0) but continues to receive:

    PL/SQL: ORA-00920: invalid relational operator
    ORA-06550: line 13, column 3:
    PL/SQL: SQL statement ignored

    I know that I can DECLARE 2 sliders and then use a conditional to run one or the other, but in the interest of the growth and written some thing a little more sophisticated, I was hoping that someone with more experience SQL could tell me how [s] he would do this.

    Thanks in advance for your time.

    I guess that l_subbgt_nbr is a variable?

    In any case, something like this:

    SELECT col_1,
    col_2,
    etc ...
    FROM CN_BGT_ENTRIES
    WHERE grnt_id = p_grnt_id
    AND  ( ( l_subbgt_nbr is null and  subbgt_nbr is null )
              OR ( l_subbgt_nbr is not null and  subbgt_nbr = (SELECT MAX(subbgt_nbr)
                                                            FROM CN_BGT_ENTRIES
                                                            WHERE grnt_id = p_grnt_id)
                    )
               ); 
    

    Cheers, APC

    Published by: APC on July 23, 2012 15:46

  • How to assign a default value to a column?

    Hello

    Is it possible to alter a column in order to assign a default value for the column in the object browser?

    I have a RECORD of table in which I want to assign a value to 0 by default to a column whose type is NUMBER.

    Thank you for your kind replies.

    Christian.

    Hello

    In SQL, do something like:

    ALTER TABLE FICHE MODIFY ("Fieldname" NUMBER(n, n) DEFAULT 0 NOT NULL ENABLE)
    

    Replace Fieldname and n, n, as the case

    Andy

Maybe you are looking for