Set a column to be nullable

Hi, I am not really good at SQL. Please help me if you can.
I have a column that's Nullable (yes), default (1). Now I want to set the default of the column to null and set the column to be nullable. Here is what I am doing:
create table testit
(foo number default 1 not null, doo varchar(10));
insert into testit (foo, doo) values (15, 'a')
insert into testit (foo, doo) values (14, 'b')
insert into testit (doo) values ('c')
select * from testit
This will return 3 rows where foo=1 when doo='c'. Now I do:
ALTER TABLE testit
modify foo DEFAULT NULL
This will set the default value of foo to be NULL, however, the Nullable is still No. Then when I do
insert into testit (doo) values ('ddd')
I get "cannot insert Null into (testit.foo). What should I do?
Thanks. :D

SQL> create table testit
  2  (foo number default 1 not null, doo varchar(10));
Table created.
SQL> insert into testit (foo, doo) values (15, 'a');
1 row created.
SQL> insert into testit (foo, doo) values (14, 'b');
1 row created.
SQL> insert into testit (doo) values ('c');
1 row created.
SQL> commit;
Commit complete.
SQL> select * from testit;
       FOO DOO
        15 a
        14 b
         1 c
SQL> describe testit;
Name                                      Null?    Type
FOO                                       NOT NULL NUMBER
DOO                                                VARCHAR2(10)
SQL> ALTER TABLE testit
  2  modify foo DEFAULT NULL;
Table altered.
SQL> describe testit;
Name                                      Null?    Type
FOO                                       NOT NULL NUMBER
DOO                                                VARCHAR2(10)
SQL> insert into testit (doo) values ('ddd');
insert into testit (doo) values ('ddd')
ERROR at line 1:
ORA-01400: cannot insert NULL into ("TESTIT"."FOO")
SQL> select constraint_name from all_cons_columns
  2   where table_name = 'TESTIT';
CONSTRAINT_NAME
SYS_C00289436
SQL> select search_condition from all_constraints
  2   where constraint_name =  'SYS_C00289436';
SEARCH_CONDITION
"FOO" IS NOT NULL
SQL> alter table testit drop constraint SYS_C00289436;
Table altered.
SQL> insert into testit (doo) values ('ddd');
1 row created.
SQL> commit;
Commit complete.
SQL>

Similar Messages

  • How to show next set of columns in a adf table

    hi,
    i want to display 999 no of columns in a adf table. since it is not a better way to show all the columns in the adf table at a time, we want to show 10 columns at first and by using the next and previous links the user can see the next and previous set of columns. i dont know how to do this. please help me.
    parameswaran

    You have to put table name in Capital letters
    Like
    SELECT COUNT(1)
      FROM user_tab_columns
    WHERE table_name = 'EMP';
    or
    SELECT COUNT(1)
      FROM user_tab_columns
    WHERE table_name = UPPER('Emp');Regards
    Arun

  • Is there any way to set default column widths in the Finder's Column view

    When my Finder windows open in column view, all the columns are always VERY wide. I have to then spend time resizing them to a managable width. Is there any way to set default column widths in the Finder's Column view?
    <Re-Titled By Host>

    No, because you can't set a columns view default.
    27" i7 iMac (Mid 2011) refurb, OS X Yo (10.10), Mavs, ML & SL, G4 450 MP w/10.5 & 9.2.2

  • OLE2 how to set a column width of an excel file i'm creating?

    how can i set the column width in an excel file i'm creating with ole?
    or even, haw can i set the auto-fix properties?

    Hallo !
    SORRY MY ENGLISH is very BAD.
    I tried to set page header and  footer in Excel sheet with abap ole
    DATA : BEGIN OF enter,
             x(1) TYPE x VALUE '0D',
            END OF enter.
    DATA : format(255) TYPE c.
    FORM set_page_sheet.
      CALL METHOD OF excel 'ActiveSheet' = sheet.
      CALL METHOD OF sheet 'PageSetup' = pagesetup.
      SET PROPERTY OF pagesetup 'Orientation' = xllandscape.
      SET PROPERTY OF pagesetup 'PrintTitleRows' = '$9:$12'.
      CLEAR format.
    ERROR
      CONCATENATE 'PAGESHEET' enter-x 'PAGE &P/&N' INTO format.
    ERROR
      SET PROPERTY OF pagesetup 'RightHeader' = format.
      CLEAR format.
      CONCATENATE ' Text 1 ' enter-x 'Text 2'
    enter-x 'Text 3 ' INTO format.
      SET PROPERTY OF pagesetup 'RightFooter' = format.
      FREE OBJECT pagesetup.
    ENDFORM.                    " set_page_sheet
    Activate report -
    ERROR - The enter-x must by data type c or another then data type x
    Thanks for answer.

  • How to set the column order of a sealed column in a custom Content Type for the new item form NewDocSet.aspx?

    Dear SharePoint Developers,
    Please help.
    I need to know How to set the column order of a sealed column in a custom Content Type for the new item form NewDocSet.aspx?
    I think this is a "sealed column", whatever that is, which is  shown in SPD 2013 as a column of content type "document, folder, MyCustomContentType".
    I know when I set the column order in my custom Content Type settings page, it is correct.
    But, when I load the NewDocSet.aspx page, the column order that I set in the settings page is NOT used for this "sealed column" which is bad.
    Can you help?
    Please advise.
    Thanks.
    Mark Kamoski
    -- Mark Kamoski

    Hi,
    According to your post, my understanding is that you want to set the column order of a sealed column in a custom Content Type for the new item form NewDocSet.aspx.
    Per my knowledge, if you have Content Type management enabled for the list or library (if you see a list of content type with the option to add more), the display order of columns is set for each content type.
    Drill down into one of them and you'll see the option under the list of columns for that content type.
    To apply the column order in the NewDocSet.aspx page, you need to:
    Select Site Settings, under Site Collection Administration, click Content type publishing. In the Refresh All Published
    Content Types section, choose Refresh all published content types on next
    update.
    Run two timer jobs(Content Type Hub, Content Type Subscriber) in central admin(Central Administration--> Monitoring--> Review timer jobs).
    More information:
    http://sharepoint.stackexchange.com/questions/95028/content-types-not-refreshing-on-sp-online
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • Set the column name of a table in a list box

    is there any code to set the column name of a table in a list box at oracle devloper 6i?
    pls help.

    I dont want to go for pl/sql . It should work any table.You want Dynamic SQL without using PL/SQL? Tricky. I'm sure there's a possible way using some very complex and convoluted XML functionality of SQL but in reality you are asking for something that isn't natural to SQL queries, especially if you are expecting a dynamic number of columns to be produced for each row of data. SQL expects a table structure, including output formats, to be a defined number of columns with any number of rows, not a defined number of rows with any number of columns.
    Perhaps if you explain why you need this sort of functionality then we may be able to offer a better solution.
    ;)

  • Set the column length in an sql query

    Hi,
    Is there a way to set the column length in a query without using sqlplus commands like row size and format column.
    I'd like to do it just from the sql query itself.
    select 'this is a test' from dual; Can I define the width of this column in the select statement
    Cheers.

    Use RPAD,
    SQL> WITH T
      2       AS (SELECT 'this is test' str FROM DUAL
      3           UNION ALL
      4           SELECT 'this is a long test' FROM DUAL
      5           UNION ALL
      6           SELECT 'this is a long long long long test' FROM DUAL)
      7  SELECT RPAD ( str, 20) str,LENGTH( RPAD ( str, 20)) len
      8    FROM T;
    STR                         LEN
    this is test                 20
    this is a long test          20
    this is a long long          20
    SQL> G.

  • How to set displayed column width for a search help

    I have created an elementary search help for a custom field with a value table behind it.
    The search help functions correctly, but when displayed the column widths are all 10 characters. The user has to adjust the column to view the descriptive text.
    Can anyone tell me how to set default column widths for the help?

    Please  open you Elementary search  help  and see the Column  width   behind the Fields of your ...there  increase the width of the fields
    "Activate it  and refresh
    reward  points if it is usefull .....
    Girish

  • How do I set the column content to automatic break lines

    Hello Guys,
    I have a problem with the column width and the column content of a standard report. Within the report are hugh entries which aren't interrupted by an space character. I set my column width to a special value by usingen "css style: display block; width: 300px;". Now the problem is that some of the column entries have a longer width than the column width is setted. So they overlock the entries of the column next to them.
    My question is: How do I set the column content to automatic break lines after a certain count of characters?
    After researching a couple of websites and discussion thread I found maybe a reference to the solution. I hope it help you to give me an answer.
    COLUMN LAST_NAME FORMAT A4
    regards
    wderr

    Wderr,
    PDFs are another animal entirely. Try adjusting the width of the column under the Print Attributes tab of the report.
    If that doesn't work you'll probably need to create custom XSL-FO layouts which, depending on the tools you have at your disposal, could take some time.
    Regards,
    Dan
    Blog: http://DanielMcGhan.us/
    Work: http://SkillBuilders.com/

  • Using CASE to return a set of columns

    Good day all,
    Many times I have used the CASE construct to return a value based on a set of conditions but now I have a need to return a set of columns based on a set of condition.
    Look at this
    A
    =====
    id
    name
    account
    zip_code
    status
    B
    =====
    id
    name
    account
    zip_code
    C
    =======
    id
    name
    account
    zip_code
    D
    ======
    id
    name
    account
    zip_code
    I want a query that would return
    id - of A
    name, - of A
    beneficiary, - name column of either, A, B, C or D depending on the value of A's status (A, B, C, D)
    account, - account column of either, A, B, C or D depending on the value of A's status (A, B, C, D)
    zip_code - zip_code column of either, A, B, C or D depending on the value of A's status (A, B, C, D)
    Can anyone help with construct that could achieve this with queries only. I don't feel like this warrants PLSQL.
    regards

    Hi,
    Is this what youa re looking for?
    As Frank has said not sure what is the relationship between your tables and what Output you expect.
    Sample Data used.Avoid using reserved words for column like ID and NAME
    create table a (id1 varchar2(10),name1 varchar2(10),account1 varchar2(10),zip_code varchar2(10),status varchar2(10))
    create table b (id1 varchar2(10),name1 varchar2(10),account1 varchar2(10),zip_code varchar2(10))
    create table c (id1 varchar2(10),name1 varchar2(10),account1 varchar2(10),zip_code varchar2(10))
    create table d (id1 varchar2(50),name1 varchar2(50),account1 varchar2(50),zip_code varchar2(50))
    insert into A values (0, 'michael', '000000', '213401', 'A');
    insert into A values (1, 'johnson', '63423', '093401', 'B');
    insert into A values (2, 'fred', '23221', '203901', 'D');
    insert into B values (1, 'brother', '1129812', '093083');
    insert into B values (2, 'stuggard', '0093732', '087366');
    insert into B values (3, 'jekins', '9009387', '329838');
    insert into C values (1, 'mary', '009300', '093083');
    insert into C values (2, 'lori', '112212', '654032');
    insert into C values (3, 'helen', '909083', '938292');
    insert into D values (1, 'mother & father', '093291', '329232');
    insert into D values (2, 'Uncles & Aunties', '098762', '742326');
    insert into D values (3, 'Grannies', '237643', '864433');
    Query
    select 
    case when a.status='A' then
    a.id1
    when a.status='B' then
    b.id1
    when a.status='C' then
    c.id1
    when a.status='D' then
    d.id1
    end ID1,
    case when a.status='A' then
    a.name1
    when a.status='B' then
    b.name1
    when a.status='C' then
    c.name1
    when a.status='D' then
    d.name1
    end ID1
    ,case when a.status='A' then
    a.account1
    when a.status='B' then
    b.account1
    when a.status='C' then
    c.account1
    when a.status='D' then
    d.account1
    end account1,
    a.status status,
    case when a.status='A' then
    a.zip_code
    when a.status='B' then
    b.zip_code
    when a.status='C' then
    c.zip_code
    when a.status='D' then
    d.zip_code
    end zip_code
    from a ,b,c,d
    where a.id1=b.id1 and b.id1=c.id1 and c.id1=d.id1Cheers!!!
    Bhushan

  • SQL Query (Updateable Report) conditionally set a column read-only with lov

    Hi
    I'm attempting to set a column that has a select list lov read-only if there is existing data in the column otherwise permit the end-user to enter a value using the select list.
    I've looked at Re: A better method of handling tabular forms with variable column type? and using this code as an example it almost works, except the select list lov button is still active and therefore the data can be changed. How does one conditionally disable the select list lov button in Javascript?
    TIA

    In the JS code where you make the field readonly, add another line to hide the lov opener link ( in jQuery it would be *$('<selector>').hide()* ).
    If you can provide the HTML code from your page for such a column (the JS code would depend on the template/theme), I can try helping.

  • New to portal: Setting the column width in portal QBE report

    I'm trying to set different widths to different columns in the QBE report. One of the columns in the report contains long descriptive text. With the default column width the reports runs into many pages and user has to scroll a lot. I would like to set the column width for this column so that it does not wrap for every 2/3 words. In the customization tab, I'm setting the width type to "Char" and selecting the number of characters to be displayed in that coulmn. Percent/pixel width type also didn't help. Should I set the Header width also?. I'm not sure where to set this header column width.QBE report just ignores these customization parameters and displays the report in default format. Please let me know if you have any idea/solution to this problem.
    Thanks
    Surya

    Hi,
    This is a bug and has been fixed 30984.
    Thanks,
    Sharmila

  • Set Variable column in the Column page?

    Hi,
    I try to do this exercise but I facing some understanding problem, please guide me.
    This is BIEE example to do Oracle BI publisher and Dashboard.
    1. Create a dashboard prompt for the region and state to filter the BI publisher report results on the dashboard.
    a. In Answers, open Region and State Prompt.
    b. In the Set Variable column, select None from the drop-down list
    c. Save the prompt in the My Sales folder as Region and state Prompt – No Variable.
    My question from step a and b, I did not see any “Region and State Prompt” in Answers. Then clik Subject Areas – SupplierSales, then assign Region, and State. Then I try to make Set Variable column None. But I did not see where is Set Variable column in the Column page. May be I am doing wrong.
    Please guide me to complete this.
    Thanks,
    Jo.

    BindingContext bindingctx = BindingContext.getCurrent();
    BindingContainer bindings = bindingctx.getCurrentBindingsEntry();
    DCBindingContainer bindingsImpl = (DCBindingContainer)bindings;
    DCIteratorBinding dciter = bindingsImpl.findIteratorBinding("prv_supvo1Iterator");
    ViewObject vo = dciter.getViewObject();
    vo.setNamedWhereClauseParam("BDIVN", divn);
    vo.executeQuery();
    where BDIVN is our bind variable.

  • How to use Special value set with Column clause to display addtional column

    hi
    can anyone tell me
    How to use Special value set with Column clause to display addtional column
    how can i use FND POPID and with COLUMN clause ?

    Dear Yaseen,
                To get the value in formula cumulative,after you have created the formula for that particular key figure,go to edit and click on tab "calculations".
    In that select overall result as 'count all values not equal to zero' and single result as 'count all values not equal to zero' .
    And mark the cumulative check box underneath.
    I hope you get the desired result and please do me favour .
    Sumit goomber

  • How to set unequal columns using master pages in InDesign CS3?

    How to set unequal columns using master pages in InDesign CS3?

    I don't have CS3 anymore but I don't think this has substantially changed in the last few versions of InDesign.
    Choose View > Grids & Guides > uncheck Lock Column Guides. Then drag the column guides to the position you want.

Maybe you are looking for

  • How do we proceed re: Heartbleed?

    I don't want to steal MadMacs0 thunder. So I'd like to open a new thread - albeit with all due respect to him.  His post , IMHO is just too important to slip through the cracks or to be potentially construed as being off-topic. Check it out > https:/

  • Powerbook to TV Cable Problems

    Hi, I have just bought what I thought would be a quality tv cable so that I can watch dvd's on my tv using my Powerbook. However having tried it I can only get a black and white picture. I have searched the internet and forums and I the only thing I

  • Hide Push Button

    I have a scenario where the ITS Template OK CODE is working in ECC 6.0 so we have had decided to Hide Push Button.Plz can any one give the solution for this

  • No 'AC_RunActiveContent.JS' in Flash CS4

    Hey Folks, Having same problem as most with Internet Explorer 8. Comes up with pop up bar when loading your flash movie. This was remedied in the past when Flash created a file named "AC_RunActiveContent.JS" along with the HTML file after you publish

  • Rescue And Recovery Install error

    trying to install on my X61 but not sure why it wont install. I get the following (why can't I copy/paste the error message btw??) Error 25014 : There was an error installing the rescue and recovery boot manager : return code 6 Any idea's? Lenovo X20