Oracle Forms 10g - why do I have to click save so that my insert query will save to database - oracle10g

why do i have to click save button in the upperleft on formservlet so that my insert query will save to database? im sorry guys, quite newbie here thanks
here is my pl sql code in add button trigger:
begin
insert into tb_distributor
(distributor_id, distributor_name, distributor_type, distributor_desc)
values
(distributor_id.nextval,:DISTRIBUTOR_NAME, :DISTRIBUTOR_TYPE, :DISTRIBUTOR_DESC);
commit;
end;

Oracle Forms provides a great deal of functionality for you so that you don't have to write it. For example, if you base a block on a table, and if the user enters data and clicks "Save", Oracle Forms knows whether to execute Insert, Update or Delete statements appropriately followed by a Commit.
In your case, you have ignored that functionality and have hardcoded an Insert and Commit in your button code. Therefore, the user does not have to click the Save button, because the data has already been "saved" by your Add button.

open the property palette for this data block and change the database data block item to NO
and start writing your PL/SQL manually.

Related

How to know in Talend if tMySQLInput will overwrite data?

I have one already existing Talend Open Studio tMySQLInput component with some sql code inside it, in order to retrieve some joined columns linked to a tMySQLOuput component (pointing to an already existing MySQL table) with few records.
QUESTION:
Will the "tMySQLInput" component overwrite the already existing table data that the tMySQLOutput component relates to? I mean is there an option to check in the tMySQLInput our output in order to say, overwrite each time this job is executed ?
Thank you all.
Yes, there is an option where in tMySQLOutput where you can specify what action you want to do to your table. Follow following steps:
Go to component tab of tMySQLOutput, it will open the basic settings of this component.
If you will look closer you will find Action on table. This is the action which you can perform on the table which is pointed by tMySQLOutput. It has options as Default, Drop and Create Table etc.
Then you have Action on data. These are the options which you can perform on the data like Insert, Update etc.
In your case I suppose you can choose Action on Table as Default and Action on Data as Insert. Default action would not do anything on the table and Insert option would insert the records at the end of table. But in case of Insert if you will have duplicate rows then job would stop the moment it will find any duplicate row.

oracle form ''you cannot update this record''

I have a procedure in which I get values from different tables and calculate a certain decimal number. After that i try to post it on a form text-field which is a database item (update and insert allowed on the settings of block and item). everything works fine but the result wont show on the item and won't save in the database field. I get the error
"you cannot update this record".
Can someone help? i have been working on it for two days now and can't find anything.
Did you check if your user has update access on the table?
Check also if there are database triggers on the table that prevents you from updating the record.

Oracle Forms 10g LOV not showing up second time

I have created Oracle Forms 10g form and want to display LOV by pressing the button. On When-Button-Pressed trigger I have:
go_item('MyBlock.Item1');
do_key('LIST_VALUES');
LOV has 6 columns and 2 of them are bound to 2 items: MyBlock.Item1 and MyBlock.Item2. When I press the button LOV appears and I can make a choice. LOV inserts data into MyBlock.Item1 and MyBlock.Item2 and everything is fine.
But if I want to make another choice and press the button again LOV doesn't appear. I don't know what is the problem.
Button and both items are in the same data block, I set Update Allowed and Required to No for both items and Mouse Navigate to No for button (I saw this on few forums).
Try putting synchronize command between these two lines:
go_item('MyBlock.Item1');
Synchronize;
do_key('LIST_VALUES');
I finally found solution (using oracle's OTN discussion).
The problem was stored procedure I call after first popping up of LOV. First time, after I chose a value I delete record of another block using stored procedure. In that procedure I set values of columns MyBlock.Item1 and MyBlock.Item2 are connected with. But on the form the old values remains on items. I removed update this two columns in procedure and it works now. But I needed this two fields to be updated to null automatically.
The solution is that I first change values of those items on form and then I call stored procedure. It works now.

DB2 AS400 Triggers

I've been tasked with finding a way to migrate data into a DB2 AS400 database. When the data is entered (currently manually) on the front end, the system is doing some calculations and inserting the results in a table.
My understanding is that it's using a trigger to do so. I don't know very much about this stuff, but I have written code to directly insert values into that same table. Is there a way for me to figure out what trigger is being fired when users enter data manually?
I've looked in QSYS2/SYSTRIGGERS and besides not making much sense to me, I see no triggers that belong to the SCHEMA with my table in it.
Any help here would be awesome, as I am stuck.
SELECT *
FROM QSYS2.SYSTRIGGERS
WHERE TABSCHEMA = 'MYSCHEMA'
AND TABNAME = 'MYTABLE'
Should work fine.
If you'd prefer to use a 5250 command line, the Display File Description (DSPFD) command will show you the triggers on a file (table)
DSPFD FILE(MYSCHMA/MYTABLE) TYPE(*TRG)
Lastly, trigger information is available via the IBM i Navigator GUI. Either the older fat client version or the newer web based one.

Autonumbering in forms in Access

I have a form in access that saves the data in a database and I want one of the fields to be automatically calculated as the next value in line as the ID so that the user doesnt write the ID. does anyone have any ideas?
Create your table using an Autonumber data type.
If you manually create your tables then this statement
CREATE TABLE TableThatIncrements
(
Id AUTOINCREMENT(1001,1)
)
Alternately you can edit your existing table Id column using:
ALTER TABLE TableThatIncrements
ALTER COLUMN Id AUTOINCREMENT(1001,1)
If you do not, then you can change per the article I mentioned via the GUI interface. See steps in this article: https://superuser.com/questions/288087/how-do-i-set-the-first-value-of-autonumber-in-access
You can run a query in Access by doing the following:
Go to the "Create" tab and click "Query Design"
Just close the window that appears which asks you to select tables, we don't need that.
Go to the "Design" tab and click the button with the arrow until you get a textual input screen. (By default, it says SELECT;).
Delete the default text and paste the above query.
Click "Run".