Loading ...
Sorry, an error occurred while loading the content.

Re: how can I set a DEFAULT VALUE for a field ?

Expand Messages
  • tpriyambodo
    Thanks Ron for all the answer. I think I must change XML and DTD ( I dont have enough understanding of Java). Or I will use MySQL that can define empty string
    Message 1 of 3 , Dec 5, 2004
    • 0 Attachment
      Thanks Ron for all the answer. I think I must change XML and DTD ( I
      dont have enough understanding of Java). Or I will use MySQL that
      can define empty string and nulls.
      the reason I want to use default value just because oracle can
      determine empty string and null.Thats the main reason

      Thanks for clear answer


      --- In xml-dbms@yahoogroups.com, Ronald Bourret <rpbourret@r...>
      wrote:
      > Unfortunately, XML-DBMS does not currently support database
      defaults.
      > This is a bug and is not easy to fix.
      >
      > There are two workarounds I can think of:
      >
      > 1) Add the default value to the XML document before passing it to
      > XML-DBMS. For example, you could do this with XSLT or a SAX filter.
      >
      > 2) Add a trigger to the database so that a null value is changed
      to the
      > default.
      >
      > -- Ron
      >
      > tpriyambodo wrote:
      >
      > >
      > > First I intoduce my self. I am a research student from
      Indonesia.
      > > Thanks for this incredible tool XMLDBMS
      > >
      > > I use XML DBMS to generate table in ORACLE 9i.
      > > I just want to know how can I set a default value for oracle
      table.
      > >
      > > For simple explanation this is the illustration:
      > >
      > > DTD files :
      > > <!ELEMENT EMPLOYEE(NAME,ADDRESS,SALARY?)
      > > <!ELEMENT NAME #PCDATA>
      > > <!ELEMENT ADDRESS #PCDATA>
      > > <!ELEMENT SALARY #PCDATA>
      > >
      > > table generated :EMPLOYEE with fields:NAME,ADDRESS,SALARY
      > > I set SALARY with default value $100. so, I dont need to make
      an
      > > salary element every insert a XML document
      > >
      > > For example of XML data file
      > > <EMPLOYEE>
      > > <NAME>john</NAME>
      > > <ADDRESS>red street<ADDRESS>
      > > </EMPLOYEE>
      > > will automatically add $100 in field salary of database
      > >
      > > but if there is a salary element:
      > > <EMPLOYEE>
      > > <NAME>john</NAME>
      > > <ADDRESS>red street<ADDRESS>
      > > <SALARY>$200<SALARY>
      > > </EMPLOYEE>
      > > field salary contains $200.
      > >
      > > Because, now if I didn't present the salary element, in salary
      table
      > > contains Null / empty string.I think the default value $100 is
      > > replaced by that null element same as if we give this SQL
      statement
      > > INSERT INTO EMPLOYEE VALUES('john','red street',Null);
      > >
      > > But if the SQL statement :
      > > INSERT INTO EMPLOYEE (NAME,ADDRESS) VALUES('john','red street');
      > > default value $100 still present in salary fields.
      > >
      > > How can I keep the default value of a that field?
      > > So, what is the solution of this problem? Thaks a lot, this
      mailing
      > > list is very useful for me.
    Your message has been successfully submitted and would be delivered to recipients shortly.