Home » Developer & Programmer » Forms » "unable to insert or update a view" (forms 6i)
"unable to insert or update a view" [message #315777] Tue, 22 April 2008 14:34 Go to next message
deahayes3
Messages: 203
Registered: May 2006
Senior Member

Please help,

I am using forms6i, and I have a datablock that is a view, I have a button where I would like to clear the block then insert in one of the fields to execute a query, but it keeps telling I cant insert into a view, but all I want to do is enter query and execute then display the results in the datablock.....can anyone help me solve this?
Re: "unable to insert or update a view" [message #315780 is a reply to message #315777] Tue, 22 April 2008 14:56 Go to previous messageGo to next message
Littlefoot
Messages: 21823
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
How does your code look like? Without it, it is almost impossible to guess what might be wrong.

You can't code ENTER + EXECUTE query because, as soon as ENTER_QUERY built-in is executed, Forms waits for user's input and user should then execute a query. So, combination of CLEAR_BLOCK and ENTER_QUERY is the most you can do.

However, you might consider use of setting the DEFAULT_WHERE and executing a query; perhaps it could help (if result of a query doesn't depend on user's choice, but you "somehow" know it (for example, as global variable's value)).
Re: "unable to insert or update a view" [message #315792 is a reply to message #315780] Tue, 22 April 2008 15:38 Go to previous messageGo to next message
deahayes3
Messages: 203
Registered: May 2006
Senior Member

ok, i set a DEFAULT_WHERE and then executed a query , however the datablock displays 10 records at a time, what can I do to go to the next line/record without erasing the first, this is what I have

I have a non datablock item called employee_no and a button called ENTER EMPLOYEE NUMBER, this button uses the default_where clause and displays on the screen fine , however if i decided to put in another employee number it erases the first, this is what I have....

IF :control_x.employee_no is not null then
Set_Block_Property('EMPL_MASTER_V',DEFAULT_WHERE,'employee_number = :control_x.employee_no');

Execute_Query;
Next_Record;
End if;
Re: "unable to insert or update a view" [message #315797 is a reply to message #315792] Tue, 22 April 2008 16:05 Go to previous messageGo to next message
Littlefoot
Messages: 21823
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
So, you'd like to display BOTH employees at the same time?

Two options: create another non-database item ("employee_no_2") and use both of them in the DEFAULT_WHERE, or concatenate another (and another, and another) "employee_no" to existing DEFAULT_WHERE.
Re: "unable to insert or update a view" [message #315800 is a reply to message #315797] Tue, 22 April 2008 16:29 Go to previous messageGo to next message
deahayes3
Messages: 203
Registered: May 2006
Senior Member

i see what your getting too, but I am not sure how many employee_numbers will need to be added, one day it could be 2, next 5, day after 25.... each time I execute the default_where I need each employee information to display on its own line. I dont know how to solve this.....

see example below/forum/fa/4175/0/
  • Attachment: example.jpg
    (Size: 64.65KB, Downloaded 927 times)

[Updated on: Tue, 22 April 2008 16:39]

Report message to a moderator

Re: "unable to insert or update a view" [message #315802 is a reply to message #315800] Tue, 22 April 2008 16:35 Go to previous messageGo to next message
Littlefoot
Messages: 21823
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
In that case, it seems that you don't have to do anything - just EXECUTE_QUERY regardless employee number and you'll get all of them.
Re: "unable to insert or update a view" [message #315803 is a reply to message #315802] Tue, 22 April 2008 16:41 Go to previous messageGo to next message
deahayes3
Messages: 203
Registered: May 2006
Senior Member

I only want specific employee numbers, not all.
Re: "unable to insert or update a view" [message #315869 is a reply to message #315803] Wed, 23 April 2008 01:31 Go to previous messageGo to next message
Littlefoot
Messages: 21823
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
LF
... concatenate another (and another, and another) "employee_no" to existing DEFAULT_WHERE.

Re: "unable to insert or update a view" [message #316003 is a reply to message #315869] Wed, 23 April 2008 08:22 Go to previous messageGo to next message
deahayes3
Messages: 203
Registered: May 2006
Senior Member

Do you have any examples?
Thanks.
Re: "unable to insert or update a view" [message #316115 is a reply to message #316003] Wed, 23 April 2008 16:15 Go to previous messageGo to next message
Littlefoot
Messages: 21823
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Sure.
SQL> select 'where id = ' || 1 res from dual;

RES
------------
where id = 1

SQL> select 'where id = ' || 1 || ' or id = ' || 2 res from dual;

RES
----------------------
where id = 1 or id = 2

SQL> select 'where id = ' || 1 || ' or id = ' || 2 || ' or id = ' || 3 res
  2  from dual;

RES
--------------------------------
where id = 1 or id = 2 or id = 3

SQL>

[Updated on: Mon, 28 April 2008 20:50] by Moderator

Report message to a moderator

Re: "unable to insert or update a view" [message #316315 is a reply to message #316115] Thu, 24 April 2008 10:43 Go to previous message
deahayes3
Messages: 203
Registered: May 2006
Senior Member

Thanks I tried the following and it worked as well .....
:global.old_emp_no := new_empl_num||','||:global.old_emp_no;

SELECT RTRIM(:global.old_emp_no,',')--remove extra comma
into vnum
FROM DUAL;

:global.old_emp_no:= vnum;

Set_Block_Property('EMPL_MASTER_V',DEFAULT_WHERE,'employee_number IN ('||vnum||')');

Thanks so much for the help.
Previous Topic: Connecting to different schemas in one menu
Next Topic: order by clause
Goto Forum:
  


Current Time: Sat Feb 15 07:50:03 CST 2025