Re: Insert from Select
Posted in 2003
Topics: Installation, Setup & Upgrades, SQL Development & Query Writing
RPhillips@ce-a.com wrote:
> I'm trying to insert from a select statement but it is giving me an error
> that I "Cannot modify table or view used in subquery." on my where clause.
> Why?
Because you have not upgraded to a sufficiently recent version of the
server. For a very long time, it was not possible to insert into
TableA if TableA was also mentioned in the SELECT statement.
Fortunately, that limitation has been removed in later versions.
> INSERT INTO hospcontact
> (hospital_id, name, sir_name, first_name, nick_name, use_nick_name, title,
> street, street2,
> city, state, zip, bl, bl_is_prim, stmt, stmt_is_prim, day, day_is_prim,
> pcsr, pcsr_is_prim, special, special_is_prim,
> ub92, ub92_is_prim, pl, pl_is_prim, agedbl, patient_acct_mgr,
> last_modified, phone, fax, modified_by, email)>
> Select 500368, name, sir_name, first_name, nick_name, use_nick_name, title,
> street, street2,
> city, state, zip, bl, bl_is_prim, stmt, stmt_is_prim, day, day_is_prim,
> pcsr, pcsr_is_prim, special, special_is_prim,
> ub92, ub92_is_prim, pl, pl_is_prim, agedbl, patient_acct_mgr, last_modified,
> phone, fax, modified_by, email
> from hospcontact
> where hospital_id=500349;
--
Jonathan Leffler #include <disclaimer.h>
Email: jleffler@earthlink.net, jleffler@us.ibm.com
Guardian of DBD::Informix v2003.04 -- http://dbi.perl.org/
Jonathan Leffler <jleffler@earthlink.net> wrote in message news:<3F261374.9060502@earthlink.net>... > RPhillips@ce-a.com wrote: > > Because you have not upgraded to a sufficiently recent version of the > server. For a very long time, it was not possible to insert into > TableA if TableA was also mentioned in the SELECT statement. > Fortunately, that limitation has been removed in later versions. > I have been getting error -360 on 9.3. In what version was it fixed?
On 29 Jul 2003 07:03:53 -0700, anderssonk75@hotmail.com (Kristofer Andersson) wrote: >Jonathan Leffler <jleffler@earthlink.net> wrote in message news:<3F261374.9060502@earthlink.net>... >> RPhillips@ce-a.com wrote: >> >> Because you have not upgraded to a sufficiently recent version of the >> server. For a very long time, it was not possible to insert into >> TableA if TableA was also mentioned in the SELECT statement. >> Fortunately, that limitation has been removed in later versions. >> > >I have been getting error -360 on 9.3. In what version was it fixed? We're on 9.30.HC3 . . . no problems. Is this a table or a view??