RE: Insert problem

RE: Insert problem

 

  

It's not a bug, if no data is found then a MAX will still return a row (with
NULL).

This should work:

INSERT INTO EMP(EMPID,ENAME) VALUES( (SELECT NVL(MAX(EMPID),0) FROM EMP_REG
WHERE ENAME='SACHI'),'DFGH');

-----Original Message-----
From: Sachidananda_T
[mailto:oracledba-ezmlmshield-x41787493.[Email address protected]
Sent: Thursday, 29 September 2005 3:25 PM
To: LazyDBA Discussion
Subject: RE: Insert problem


Yes,this is good.

But sometimes the inner select return NULL even though select fetches a
record.

Don't know why,could be a bug.

-----Original Message-----
From: Bhat Vikas
[mailto:oracledba-ezmlmshield-x14961073.[Email address protected]
Sent: Thursday, September 29, 2005 10:18 AM
To: LazyDBA Discussion
Subject: RE: Insert problem

This is just great....didnt know about this till now....

Thanks Sachi...

Vikas Bhat
Senior Software Engineer,
FBSI Pvt Ltd.,
Embassy Golf Links Business Park,
Intermediate Ring Road,
Bangalore - 560071
Email - vikas.[Email address protected]
Ph:91-80-56916482
Mob:91-9845589149
Those who aspire for the light of sun; need to bear its heat.

Any comments or statements made in this email are not necessarily those
of Fidelity Business Services India Pvt. Ltd. or any of the Fidelity
Investments group companies. The information transmitted is intended
only for the person or entity to which it is addressed and may contain
confidential and/or privileged material. If you have received this in
error, please contact the sender and delete the material from any
computer. All e-mails sent from or to Fidelity Business Services India
Pvt. Ltd. may be subject to our monitoring procedures.



-----Original Message-----
From: Sachidananda_T
[mailto:oracledba-ezmlmshield-x73227432.[Email address protected]
Sent: Thursday, September 29, 2005 9:43 AM
To: LazyDBA Discussion
Subject: RE: Insert problem


Hi Vikas,

Try this,

insert into t1 values((select 1 from dual));

This should work.

One more example

insert into dept(dno,dname) values(10,'purchasing');

insert into emp(empno,dept)
values(10,(select dno from dept where dname='purchasing'))

Regards
Sachi

-----Original Message-----
From: Bhat Vikas
[mailto:oracledba-ezmlmshield-x57980358.[Email address protected]
Sent: Thursday, September 29, 2005 9:38 AM
To: LazyDBA Discussion
Subject: RE: Insert problem

Hi Salahuddin,

I know this but the example given below was for Sachi, because he said
in his reply that putting select inside a values clause of insert works
in Oracle 9i. Since I couldn't get the thing working, I thought maybe I
was missing something here.

Thanks and regards,
Vikas Bhat
Senior Software Engineer,
FBSI Pvt Ltd.,
Embassy Golf Links Business Park,
Intermediate Ring Road,
Bangalore - 560071
Email - vikas.[Email address protected]
Ph:91-80-56916482
Mob:91-9845589149
Those who aspire for the light of sun; need to bear its heat.

Any comments or statements made in this email are not necessarily those
of Fidelity Business Services India Pvt. Ltd. or any of the Fidelity
Investments group companies. The information transmitted is intended
only for the person or entity to which it is addressed and may contain
confidential and/or privileged material. If you have received this in
error, please contact the sender and delete the material from any
computer. All e-mails sent from or to Fidelity Business Services India
Pvt. Ltd. may be subject to our monitoring procedures.



-----Original Message-----
From: Salahuddin
[mailto:oracledba-ezmlmshield-x65995950.[Email address protected]
Sent: Wednesday, September 28, 2005 6:30 PM
To: LazyDBA Discussion
Subject: RE: Insert problem


Try this

insert into t1(a,b) select 1, 2 from dual;


Regards,
Salahuddin







--------
website: http://www.LazyDBA.com
Please don't reply to RTFM questions
Oracle documentation is here: http://tahiti.oracle.com
To unsubscribe: see http://www.lazydba.com/unsubscribe.html
To subscribe: see http://www.lazydba.com
By using this list you agree to these
terms:http://www.lazydba.com/legal.html




DISCLAIMER:
This email (including any attachments) is intended for the sole use of the
intended recipient/s and may contain material that is CONFIDENTIAL AND
PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or
distribution or forwarding of any or all of the contents in this message is
STRICTLY PROHIBITED. If you are not the intended recipient, please contact
the sender by email and delete all copies; your cooperation in this regard
is appreciated.



--------
website: http://www.LazyDBA.com
Please don't reply to RTFM questions
Oracle documentation is here: http://tahiti.oracle.com
To unsubscribe: see http://www.lazydba.com/unsubscribe.html
To subscribe: see http://www.lazydba.com
By using this list you agree to these
terms:http://www.lazydba.com/legal.html
Disclaimer
****************************************************************************
**
This message contains privileged and confidential information intended only
for the use of the addressee named above. If you are not the intended
recipient of this message, you are hereby notified that you must not
disseminate, copy, or take any action in reliance on it. If you have
received this message in error, please notify Morris International
immediately and delete all copies. Any views expressed in this message are
those of the individual sender, except where the sender specifically states
them to be the views of Morris International.
****************************************************************************
**


Oracle LazyDBA home page