Insert or update in the form
Dear all,
i have a item. That is displaying a phone no;
and that can be insertable and updateable item.
if update the item that has to update in a anothe table.
for this can i use the when_validate_item trigger for updating
--ADDED FOR UPDATE THE CONTACT NO
BEGIN
UPDATE AZBJ_RC_RE_DETAILS
SET EMP_LAND_LINE=:CONTROL.RE_PH_NO
WHERE EMP_OPUS_ID=:CONTROL.V_USER;
COMMIT;
EXCEPTION
WHEN OTHERS THEN
NULL;
END;
please guide me can i use like this
Thanks in advance
Regards
venkat.
Hello Venkat,
If you want to update another table then it is good that you do it at Database level not on Form level. Because if you even don't save this form, the trigger's Update statement will fire. and you will have different values on both table.
So do it at Database Table Level FOR EACH ROW Trigger on BEFORE UPDATE. Example as follows,
IF :NEW.RE_PH_NO != :OLD.RE_PH_NO THEN --For check that if value changed then update other table.
UPDATE AZBJ_RC_RE_DETAILS
SET EMP_LAND_LINE=:NEW.RE_PH_NO
WHERE EMP_OPUS_ID=:NEW.V_USER;
END IF;Regards,
Danish
Similar Messages
-
Can we use both INSERT and UPDATE at the same time in JDBC Receiver
Hi All,
I would like to know is it possible to use both INSERT and UPDATE at the same time in one interface because I have a requirement in which I have to perform both the task.
user send the file which contains both new and old record and I need to save those in MS SQL database.
If the record exist then use UPDATE otherwise use INSERT.
I looked on sdn but didn't find any blog which perform both the things at the same time.
Interface Requirement
FILE -
> PI -
> JDBC(INSERT & UPDATE)
I am thinking to use JDBC Lookup but not sure if it good to use for bulk record.
Can somebody please suggest me something or send me the link of any blog or anything to solve this problem.
Thanks,Hi ,
If I have understood properly the scenario properly,you are not performing insert and update together. As you posted
"If the record exist then use UPDATE otherwise use INSERT."
Thus you are performing either an insert or an update which depends on outcome of a search if the records already exist in database or not. Obviously to search the tables you need " select * from ... where ...." query. If your query returns some results you proceed with update since this means there are some old records already in database. If your query returns no rows you proceed with "insert into tablename....." since there are no old records present in database.
Now perhaps the best method to do the searching, taking a decision to insert or update, and finally insert or update operation is to be done by a stored procedure in MS SQL database. A stored procedure is a subroutine available to applications accessing a relational database system. Here the application is PI server. If you need further help on how to write and call stored procedure in MS SQL you can look into these links
http://www.daniweb.com/web-development/databases/ms-sql/threads/146829
http://www.sqlteam.com/article/stored-procedures-parameters-inserts-and-updates
[ This part you can ignore, Since its not sure that you will face this situation
Still you might face some problems while your scenario runs. Lets consider this scenario, after the stored procedure searches the database it found no rows. Thus you proceed with an insert operation. If your database table is being accessed by multiple applications (or users) other than yours then it is very well possible that after the search operation completed with a null result, an insert/update operation has been performed by some other application with the same primary key. Now when you are trying to insert another row with same primary key you get an error message like "duplicate entry not possible for same primary key value". Thus you need to be careful in this respect. MS SQL has a feature called "exclusive locks ". Look into these links for more details on the subject
http://msdn.microsoft.com/en-us/library/aa213039(v=sql.80).aspx
http://www.mssqlcity.com/Articles/Adm/SQL70Locks.htm
http://www.faqs.org/docs/ppbook/r27479.htm
http://msdn.microsoft.com/en-US/library/ms187373.aspx
http://msdn.microsoft.com/en-US/library/ms173763.aspx
http://msdn.microsoft.com/en-us/library/e7z8d5hf(v=vs.80).aspx
http://mssqlserver.wordpress.com/2006/11/08/locks-in-sql/
http://www.mollerus.net/tom/blog/2008/03/using_mssqls_nolock_for_faster_queries.html
There must be other methods to avoid this problem. But the point is you need to be sure that all access to database for insert/update operations are isolated.
regards
Anupam -
AFTER INSERT OR UPDATE TRIGGER the insert not working
The update works but the insert is not working. I have two version that I have tried. I amd executing the inserts/update from Oracle Applications and the table row is either being inserted or updated correctly.
DROP TRIGGER APPS.CCC_HZ_ORG_CONTACTS_ARU;
CREATE OR REPLACE TRIGGER APPS.CCC_HZ_ORG_CONTACTS_ARU
/* --Created By: SKELLEHER
--Creation Date: 07/15/09
--Last Updated By:
--Last Update Date:
AFTER INSERT OR UPDATE OF department, job_title
ON apps.hz_org_contacts
FOR EACH ROW
WHEN (
NEW.department <> OLD.department OR
NEW.job_title <> OLD.job_title
DECLARE
v_ChangeType VARCHAR2(10);
BEGIN
/* Use 'I' for Insert, 'U'' for Update, and'D' for delete(not part of app at this time). */
IF INSERTING THEN
v_ChangeType := 'INSERT';
ELSIF UPDATING THEN
v_ChangeType := 'UPDATE';
ELSE
v_ChangeType := 'DELETE';
END IF;
INSERT INTO cust.ccc_tca_po_tf_event_tbl
VALUES (ccc_tca_po_tf_event_tbl_s.NEXTVAL
, 'hz_org_contacts'
, v_ChangeType
, 'org_contact_id'
, :NEW.org_contact_id
, 'PENDING'
, NULL
, 0
, 'N'
, 'Y'
, :NEW.LAST_UPDATED_BY
, :NEW.LAST_UPDATE_DATE
, -1
, SYSDATE
, 'DEPARTMENT_JOBTITLE_UPDATE'
,'LDAP'
END;
AND I TRIED ANOTHER VERSION:I have simplified it so it's just checking for insert but it's not picking up. Is the syntax IF INSERTING correct?
CREATE OR REPLACE TRIGGER APPS.CCC_HZ_ORG_CONTACTS_ARU
AFTER INSERT OR UPDATE
ON ar.hz_org_contacts
FOR EACH ROW
DECLARE
BEGIN
IF INSERTING THEN
INSERT INTO cust.ccc_tca_po_tf_event_tbl
VALUES (ccc_tca_po_tf_event_tbl_s.NEXTVAL
, 'hz_org_contacts'
, 'UPDATE'
, 'org_contact_id'
, :NEW.org_contact_id
, 'PENDING'
, NULL
, 0
, 'N'
, 'Y'
, :NEW.LAST_UPDATED_BY
, :NEW.LAST_UPDATE_DATE
, -1
, SYSDATE
, 'DEPARTMENT_JOBTITLE_UPDATE'
,'LDAP'
END IF;
END;
/ -
DW CS3 Insert Record/Update Record: Record Form Wizard Error
I have just bought Dreamweaver CS3 and I am running into some
problems. I also have Dreamweaver MX 2004. When I use the Insert
Record: Record Insertion Form Wizard on my Dreamweaver MX 2004 I
have no problems using the Insert Record function. However, when I
use the Dreaweaver CS3, I am running into errors. The error I am
getting is the following..."Apache HTTP Server has encountered a
problem and needs to close. We are sorry for the inconvenience."
As well, when I use the update form wizard, when you place
all your settings and place a redirection after updating to a page
it does not do it, it stays on the same page and gives me the
following error..."Warning: Cannot modify header information -
headers already sent in C:\wamp\www\edit.php on line 50".
This happens on all internet browsers when I want to insert a
new record. It takes a long time to load the page and then it
finally gives me an error which I stated above. I never had a
problem before. I thought maybe I installed the application wrong,
so I unistalled and reinstalled the DW CS3. I still get the same
issue. I became so frustrated that I formatted my hard drive
thinking make I have a adware or spyware, so to be cautious I
formatted my computer and installed everything with a fresh install
and still I get this error. Now my testing server that I use is
called WAMP. I never had problems with it before using DW MX 2004
or when I used the trial of DW 8. So now I am out of options. Is
there a glitch in the new CS3 Web Premium that includes DW CS3
upgrade software and if there is, is there a download. Can anyone
help me, please.Please bare with me David. I know something is wrong because
I have made two folders, one that is done in MX2004 and the other
done in CS3. CS3 is generating errors. For example. In the insert
page in MX2004 I do not need to make a recordset, however, for the
CS3 insert page I noticed when I use the insert record form wizard
it does not work unless I make a recordset where in MX2004 I did
not need to do this. I've created a add.php and a edit.php of
MX2004 and CS3. I will place it in the attach code so you can see
side by side what it is generating. I can see that there are a few
things that CS3 does change and some how it is making my internet
browsers show an error saying......"Warning: Cannot modify header
information - headers already sent in C:\wamp\www\edit.php on line
50".
What do I do?
I noticed that in the following code difference in...
MX2004 = <?php echo $row_rsTest['test']; ?>
CS3 = <?php echo htmlentities($row_rsTest['test'],
ENT_COMPAT, 'utf-8'); ?>
There is a big difference.
My database is the following...
-- phpMyAdmin SQL Dump
-- version 2.10.1
http://www.phpmyadmin.net
-- Host: localhost
-- Generation Time: Jun 24, 2007 at 04:29 PM
-- Server version: 5.0.41
-- PHP Version: 5.2.3
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
-- Database: `mysample`
CREATE DATABASE `mysample` DEFAULT CHARACTER SET latin1
COLLATE latin1_swedish_ci;
USE `mysample`;
-- Table structure for table `test`
CREATE TABLE `test` (
`testID` int(11) NOT NULL auto_increment,
`test` longtext NOT NULL,
PRIMARY KEY (`testID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
-- Dumping data for table `test`
INSERT INTO `test` (`testID`, `test`) VALUES
(3, 'Sample Test');
=======================================================================
I use the program called
WAMP.
=======================================================================
PHP PAGES -
SQL INSERT / SQL UPDATE don't work with form page, don't affect table
The subject line says it all. No matter what I try, my updates on the form don't appear on the report page, which accesses the table. When I look at the table using SQL WORKSHOP, the changes aren't made there either. What am I missing? I have another report page and form page with a different table in the same application and updates in that table work fine. I coded them both the same. What should I be looking at?
Steve "the n00b" in Raleigh NCSteve,
How you have created the FORM page? Using FORM WIZARD? Or You have created blank page and after that you have manually created all the form items?
If you have used WIZARD to create form page, then you can see a page process with Automatic Row Processing (DML) type. Here you need can set DML (Insert/Update/Delete) you wish to use on this form. APEX will take care of the rest.
If there is no such process in your page, then you need to create one. You may have one process to do both (Insert and Update) and you can have two sepate processes. I prefer having two seperate page processes (after submit), one for Insert and one for Update.
Now you can make the Insert process conditional so that it only execute when you click button - Create (Add or any similar button you have ) Also make the Update process conditional so that it only execute when you click button - Save (Update or any similar button you have )
Just a quick note - From the above trigger, I can guess you are allowing users to enter Primary Key manually? In my opinion, Primary key should be always system generated using SEQUENCE. Users can only enter BUSINESS KEY (if any) and we should not use Business key as Primary Key.
Good Luck :-)
- Hari
Edited by: Hari_639 on Oct 23, 2009 8:02 PM -
I had a form that auto collected data through Adobe but it has stopped working after my Acrobat X Pro did an update.
The form no longer appears in the tracker. How can this be fixed? I am using Windows 7.
It would appear that since Adobe are going to be closing the Workspace area in January 2015 that when
Acrobat did an update the ability to connect to files in the Workspace has been removed.
Is there any way to reconnect the file back to the Tracker?
Has anyone else had the same problem?
Adobe don't seem interested in helping as this question has been posted for three days and yet no response.First and foremost thing you can do it is that reset your Firefox and after that change it to safe mode.This may be happening due to venerable links getting downloaded.
enjoy free web..... :)
regards,
Gautam sharma. -
Update a Process Form attribute during reconciliation
Hi
I wanted to updated a attribute in my process form whenever there is a reconciliation event generated for it when i run a resource reconiliation . Basically the attribute should the system time when the last reconciliation happenned ? how would i go about doing this ?
thank1. Create a field on your process as a date field.You mean, the reconciliation field mapping or what?
Or I should create a field in my resource form instead`of process?
***You aren't reconciling an existing date, you are populating this field after the reconciliation is performed. This will need to be on your process form because all reconiliation and provisioning actions are based on your process form.
5. On your reconciliation insert and update task, the response code of completed, trigger your new task.Do you mean that the new task must be conditional dependent on the completion of reconciliation task?
***Yes. When the reconciliation task is completing, this will trigger your new task to populate the current time into your date field to show the last time the user was reconciled.
If you are wanting to just record the time the resource itself was reconciled rather than individual users, you could create a User Defined field for your resource object and write a value within your recon code to that field. Or you could add a value onto your IT Resource and write the current time to that field.
-Kevin -
Default values for Insert and Update
What is the best way to default the current sysdate for a date column on a table when doing an insert or update through a form? And related to this, what is the best way to default the current user (APP_USER) for a varchar2 column when doing an insert or update through a form?
For these columns, I want to display them on a report, but they should be hidden on the form because I would like to have the app default the values to sysdate and APP_USER. However, when I have tried to use the table default values in "user interface defaults" and using either :APP_USER or &APP_USER or SYSDATE, it only shows this literal value on the form (item is not hidden while I debug this). It does not show the actual value I'd want, such as "user1". Does this make sense?
Thanks for your help.
-ReidI think triggers are the best device.
Scott -
How to find out the volume of the data updated in the custom table
Hi,
I need to find out the the volume of the data inserted or updated in the the custom table(Y tables).I have tried by the sm37.the job running in to update the table but i didnot get thde amount of the data.and if get the volume of the data which being updated in the custom table is there any option to control that amount to being updated?
Thanks in advance .....waiting for the respone.Hi Sreenivas.
How did you find the solution to this? Trying to do the same thing!
Cheers,
Tom -
I purchase the Forms + bywidgets.mu
I've followed the directions on the weblink (https://widgets.mu/se/FormsPlus/demo/)
and still can't get anything to work.
I just keep getting <> inside a box and that's it.
Help please!Hi Lisa,
Do you have a URL where I can take a look at the issue? It may be a configuration issue or it may be a bug so I just want to check and make sure.
In terms of the radio buttons one, I just published up update to the Forms+ Widget this morning that includes a new way to do grouping for radio buttons. Creative Cloud should download the updated version of the .mulib file into your downloads folder (and it should now be called something like FormsPlus Bundle.mulib), and you can double click that to add the updated widgets to your Muse library. The one I'm referring to in particular is called the "Radio Group (Box Selection)" widget. Basically, when you drag the widget out onto the page, it shows a dotted line box and you simply drag and resize the box around the radio items you'd like to group together. The box itself won't be exported so you don't have to worry about that, but it will allow you to visually group them instead of doing so with labels.
Let me know if you have any trouble getting the new update or using the box selection widget and I'd be happy to help further.
Thanks,
Andrew -
Unable to submit any item in the form library through InfoPath form
I had created a form and link to a form library, but when i click on new document it show me this dialog box with URL
ms-infopath:nft|u|.....|s|......
and then it open InfoPath form after submitting it does't not insert any value in the Form library.
In my case
1.I want to remove ms-infopath:nft|u|.....|s|......
2. Form should open in web browser.Hi
ank89 ,
Please take steps as below:
Create a Form using SharePoint Form Library template.
After customizing the form , click File ->Publish -> SharePoint Server -> save the form -> in the Publishing Wizard page input your site URL -> provide your authentication account.
Check “Enable this form to be filled out by using a browser” and Form Library.
Select your Form Library and edit the Form Library field , then Publish it and you will get what you want.
Best Regards,
Eric
Eric Tao
TechNet Community Support -
After insert or update calculate column
question about a table.
I have a table called table1
AFTER data is inserted or updated into the table1
I want to run an update on the same table (table1) with a case statement
update table1
set column2 = case
WHEN column1 = 'abc' THEN 'testl'
WHEN column1 = 'def' THEN 'test2'
ELSE 'test3'
END;
commit;
END;
i cant use a trigger because i get error since the insert would be on same table.
What else can i use for this update ? I cant use a stored procedure that runs daily or something like that because the column2 in the table needs to be populated immediately after an insert or update
thanks for any ideasSQL> CREATE TABLE TABLE1
2 (
3 COLUMN1 VARCHAR2(10),
4 COLUMN2 VARCHAR2(10)
5 );
Table created.
SQL> CREATE OR REPLACE TRIGGER TRG_TABLE1
2 BEFORE INSERT OR UPDATE OF COLUMN1 ON TABLE1
3 FOR EACH ROW
4 BEGIN
5
6 IF :NEW.COLUMN1 = 'abc' THEN
7 :NEW.COLUMN2 := 'test1';
8 ELSIF :NEW.COLUMN1 = 'def' THEN
9 :NEW.COLUMN2 := 'test2';
10 ELSE
11 :NEW.COLUMN2 := 'test3';
12 END IF;
13
14 END;
15 /
Trigger created.
SQL> INSERT INTO TABLE1(COLUMN1) VALUES('abc');
1 row created.
SQL> SELECT * FROM TABLE1;
COLUMN1 COLUMN2
abc test1
SQL> UPDATE TABLE1 SET COLUMN1 = 'def';
1 row updated.
SQL> SELECT * FROM TABLE1;
COLUMN1 COLUMN2
def test2
SQL>
{code} -
Hi All;
I want to find out all inserts and updates of a spesific table. For instance a package l,ke that
CREATE OR REPLACE PACKAGE BODY param_test IS
PROCEDURE ins_test IS
BEGIN
insert INTO parameter_value VALUES (2);
INSERT INTO parameter_value VALUES (9);
INSERT INTO
parameter_value VALUES (4);
insert INTO parameter_value VALUES (54);
END ins_test;
END param_test;I am querying user_source view. My query is below.
Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.1.0
Connected as SYS
SQL> SELECT us1.NAME, us1.line, us1.text
2 FROM user_source us1,
3 (SELECT us2.line, us2.NAME, us2.text
4 FROM user_source us2
5 WHERE regexp_like(upper(us2.text), '[[:space:]]*PARAMETER_VALUE[[:space:]]*')) us3
6 WHERE us3.line - 1 = us1.line
7 AND us1.NAME = us3.NAME
8 AND regexp_like(upper(us1.text), '[[:space:]]*(INSERT[[:space:]]*INTO|UPDATE)[[:space:]]*')
9 /
NAME LINE TEXT
PARAM_TEST 9 insert INTO parameter_value VALUES (2);
PARAM_TEST 12 INSERT INTO
SQL> My question is "Are tehre any solutions to overcome this situation?"
Kindly Regards...You might be better off combining into your attack the use of user_dependencies. This will tell you what objects e.g., code is dependent on your table and then you can search the source of those modules for inserts and updates into the table. Even then you'll never be sure, especially if dynamic SQL is used as the statement may be pieced together from various bits if strings, as then user_dependencies won't contain the reference.
-
I have a PO form, I need make some modification, i use se71 to change the form layout, the use me22n to test the form. but it still is last version, no any update after the form has been changed. How can i activate the form, Thanks!
In SE71, make sure to activate from the menu.
In change mode, click "Form" -> "Activate"
Regards,
RIch Heilman
Message was edited by:
Rich Heilman -
How to insert or update comparing values with two or more table
Hai All
I have three or four table in my database.
Table 1 Dailattend is the main table here i need to insert or update my data and the fieds are
Emplcode number,attdate date, intime date,intrin date ,introut date, outtime date are the fields
Table 2 acclempbarcode the fields are
emplcode number ,barcode number ....etc
so now my data is in text format and i have broke the date like this
0011221100112200100320100815
First 16 is barcode and next 8 is date and 4 is time and i have created a temp table and store the date and move to main table
My problem is the main table dailattend has no barcode so when i am going to insert or update i need to check whether the barcode is match with the emplcode in the main table
How can i write insert or update statement
The data is like this
00110022 is barcode,10-03-2010 is my date and 0815 is time so i need to insert into dailattend table so now i have emplcode in dailattend table so i need to compare the barcode belong the emplcode in the another table and i need to insert in the dailattend table
Pls give me some solution with example
Regards
Srikkanth.Mtry somthing like this
create table t1
as
select '0011221100112200' barcode,to_date('100320100815','ddmmyyyyhh24mi') dt
from dual
create table barcodetbl
emplcode varchar2(2000)
barcode varchar2(2000)
datetime date
merge into barcodetbl bc
using( select * from t1) x
on
(bc.barcode = x.barcode)
when matched
then update
set datetime = x.dt
when not matched
then
insert (emplcode,barcode,datetime)
values(1,x.barcode,x.dt)
/didn't realize that barcode is not in the main table.
something along the lines
Table 1 Dailattend is the main table here i need to insert or update my data and the fieds are
Emplcode number,attdate date, intime date,intrin date ,introut date, outtime date are the fields
Table 2 acclempbarcode the fields are
emplcode number ,barcode number ....etc
merge into dailattend bc
using( select * from t1, acclempbarcode ac where t1.barcode = ac.barcode) x
on
(bc.emplcode = x.emplcode)
when matched
then update
set datetime = x.dt
when not matched
then
insert (emplcode,datetime)
values(1,x.dt)
/Alvinder
Edited by: alvinder on Mar 23, 2010 3:50 PM
Maybe you are looking for
-
How do I load a music cd into iMac?
I have a new iMac (first time). I have an iPad and iPhone. I am at work and hoping to load my iTunes with stuff. Firstly how do I transfer stuff from my phone or iPad? and secondly how do I load a cd directly to the iMac?
-
Related column of a fact table - SSAS Tabular
Hi, I'm developing a SSAS Tabular model using a SQL Server 2012 SP 1 installation. For a fact table I've created some calculated columns using the DAX RELATED function. These columns not are hidden to client tools. When I deploy the project and I ope
-
How to get the FILE COUNT from File directory
Hello, i have to develop a scenario like, get the file count from source file directory and validate whether the file count is 5 or not. if 5 files exist i need to process those 5 files to DB tables. if file count is not equal to 5 then i need to se
-
I always get the feeling we are dealing with SAP Business Intelligence in a very granular manner. In a typical BI environment, the reason for denormalization or un-normalization and data cleansing is to promote and propagate intelligence. Typically i
-
Reg: Tables for Batchman jobs
Hi Experts , Is there any table which gives the information about scheduling of batchman jobs i.e. table should give the list of the batchman jobs that are scheduled daily, weekly, monthly. I found some tables but these tables(J_5H1_RUNTIME, J_5H1_BW