Home » Developer & Programmer » Forms » dynamic insert procedure
dynamic insert procedure [message #154558] Mon, 09 January 2006 07:06 Go to next message
nicnitti
Messages: 8
Registered: December 2005
Junior Member
Hello,
i need to insert a record in a table dynamically;
Exists a procedure define by

insert name_table (record rowtype%nametable)

that insert a record without write the field of the table.

The following procedure is good ,but it don't work in Oracle Forms Builder .
Error 518:This INSERT statments requires VALUES clause containing a parenthesised list of values.

DECLARE
t1_rec t1%ROWTYPE;
BEGIN
t1_rec.c1 := 1;
t1_rec.c2 := SYSDATE;
INSERT INTO t1 VALUES t1_rec;
END;


Thank you for all.
Best regards. Nicola
Re: dynamic insert procedure [message #154622 is a reply to message #154558] Mon, 09 January 2006 14:54 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Do you speak English?
Quote:

This INSERT statments requires VALUES clause containing a parenthesised list of values


VALUES containing a PARENTHESIZED list of values.

INSERT INTO t1 VALUES (t1_rec);
Re: dynamic insert procedure [message #154672 is a reply to message #154622] Tue, 10 January 2006 02:15 Go to previous messageGo to next message
nicnitti
Messages: 8
Registered: December 2005
Junior Member
Hello littlefoot,
I speak English!

The statment below

INSERT INTO t1 VALUES (t1_rec);

give error 382: Expression is of wrong type;

Regards.
Nicola
Re: dynamic insert procedure [message #154674 is a reply to message #154672] Tue, 10 January 2006 02:27 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Hello, Nicola!

I was just kidding asking you whether you speak English or not Smile It just seemed that you didn't realize what the message was saying.

I created a sample table
CREATE TABLE t1 (c1 number, c2 date);

PL/SQL block you wrote works fine when run in SQL*Plus.

Then I wrote a default form based on this table. Also, I created a push button item and attached the code you provided (with minor change - I added parenthesis where appropriate). It also worked properly.

It was done on Oracle 10g, using Forms Developer 10g. There were no errors at all, and the form worked perfectly well.

Regarding the message you received (wrong type), did you check table description? Is there, perhaps, c1 column of a CHARACTER datatype, so forms refuses to perform implicit conversion?
Re: dynamic insert procedure [message #154679 is a reply to message #154674] Tue, 10 January 2006 02:59 Go to previous messageGo to next message
nicnitti
Messages: 8
Registered: December 2005
Junior Member
Hello, Littlefoot!

I'm sorry.

The RDBMS is Oracle Database 9i and I use Forms Developer 6i Patch 4. In this situation the procedure don't work well.

Thank you for all,
Nicola
Re: dynamic insert procedure [message #154965 is a reply to message #154679] Wed, 11 January 2006 09:12 Go to previous messageGo to next message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
You need to use the collection members themselves:

DECLARE
  t1_rec t1%ROWTYPE;
BEGIN
  t1_rec.c1 := 1;
  t1_rec.c2 := SYSDATE;
  INSERT INTO t1 VALUES (t1_rec.c1,t1_rec.c2);
END;


MHE
Re: dynamic insert procedure [message #155280 is a reply to message #154558] Fri, 13 January 2006 08:51 Go to previous message
nicnitti
Messages: 8
Registered: December 2005
Junior Member
Hello Maaher
i don't want to write the name of field of the table.
i want a procedure to insert some generic field of one table.

thank you for all,Maaher

Nicola
Previous Topic: FRM-40403
Next Topic: oracle form to web application
Goto Forum:
  


Current Time: Fri Sep 20 06:42:59 CDT 2024