Retriving unique records and insert into cust and cust_det table
Hi,
uniq Table : EMP
column name
name
addr
city
addr1
city1
EMP table contains only unique records.
we neet to get the records from emp and insert into cust and cust_det accordingly
table : cust
empno : auto generated
name
addr
tabel : cust_det
empno : refer from cust
addr1
city1
plese help me to do this.
user10069916 wrote:
can some one help me to resolve this plz. bit urgent..My boss says my work is more urgent than yours.
As I said, please read: {message:id=9360002} (especially point 2)
If you post sufficient information, then people can help you. the better the information you provide the faster people will be able to help... but still, if it's "urgent" then we can only assume you have a live production system that is failing, in which case you need to raise an SR with Oracle Support, as the forums are not the place for logging "urgent" production system issues.
Similar Messages
-
Trigger a process when a record is inserted into database
Hi, could someone tell me how to do the following (if it's possible):
when a record is inserted into a table in a database,
I want it to somehow trigger an action which will put an item into user's To-Do inBox of the WorkSpace,
the user can then open the form in the To-Do and use it to view the data in the newly inserted record.
this "user"'s login ID is part of the inserted record.
thanksMmm, trigger? I don't know of a way.
But I supposed you could have a process that has a timer that peroidically queries the database for changes and then do the same thing.
You could also perhaps write a Service and then use the Java API to start a process?
Maybe take a look here
http://blogs.adobe.com/livecycle/2010/12/how-to-invoke-a-livecycle-process-periodically.ht ml -
I HAVE A SOURCE TABLE WITH 10 RECORDS AND TARGET TABLE 15 RECORDS. MY QUESTION IS USING WITH THE TABLE COMPARISON TRANSFORM .I WANT TO DELETE UNMATCHED RECORDS FROM THE TARGET TABLE ?? HOW IT IS ??
Hi Kishore,
First identify deleted records by selecting "Detect deleted rows from comparison table" feature in Table Comparison
Then Use Map Operation with Input row type as "delete" and output row type as "delete" to delete records from target table. -
How to insert into more than one table at a time also..
hi,
i am a newbee.
how to insert into more than one table at a time
also
how to get a autoincremented value of an id say transactionid for a particular accountid.
pls assume table as
transactionid accountid
101 50
102 30
103 50
104 35
i want 102 for accountid 30 and 103 for accountid 50.
thank u@blushadow,
You can only insert into one table at a time. Take a look here :
Re: insert into 2 tables
@Raja,
I want how to extract the last incremented value not to insert.Also, I don't understand your thread title... which was "how to insert into more than one table at a time also.. "
Insert, extract... ? Can you clarify your job ?
Nicolas. -
Inserting into a doubly nested table through an object view
Can anyone give me an example of an INSTEAD OF trigger that will mediate an INSERT into a doubly nested table of an Object View? Is there syntax that will allow it?
Here's some code to demonstrate. Note that relational tables, not an object table, are used to store object instances:
create or replace type TInnerNestedTable
is table of varchar2(20)
create or replace type TOuterNestedTable
is table of TInnerNestedTable
create or replace type TMyObject
is object
id varchar2(20)
, tab TOuterNestedTable
create
table T_MY_OBJECT
id varchar2(20) not null
, primary key (id)
create
table T_MY_OBJECT_TAB_OUTER
id varchar2(20) not null
, outerIndex integer not null
, primary key (id, outerIndex)
, foreign key (id) references T_MY_OBJECT on delete cascade
create
table T_MY_OBJECT_TAB_INNER
id varchar2(20) not null
, outerIndex integer not null
, innerIndex integer not null
, innerValue varchar2(20)
, primary key (id, outerIndex, innerIndex)
, foreign key (id, outerIndex) references T_MY_OBJECT_TAB_OUTER on delete cascade
create or replace view V_MY_OBJECT
of TMyObject
with object identifier (id)
as
select t.id
, cast(multiset(
select cast(multiset(
select i.innerValue
from T_MY_OBJECT_TAB_INNER i
where i.id = o.id
and i.outerIndex = o.outerIndex
) as TInnerNestedTable)
from T_MY_OBJECT_TAB_OUTER o
where o.id = t.id
) as TOuterNestedTable)
from T_MY_OBJECT t
create or replace trigger TR_II_V_MY_OBJECT
instead of insert on V_MY_OBJECT
for each row
begin
insert
into T_MY_OBJECT
id
values (
:new.id
insert
into T_MY_OBJECT_TAB_OUTER
id
, outerIndex
select :new.id
, rownum
from table(:new.tab) o;
insert
into T_MY_OBJECT_TAB_INNER
id
, outerIndex
, innerIndex
, innerValue
select :new.id
, o.outerIndex
, rownum
, value(i)
from (
select :new.id
, rownum outerIndex
, value(o) innerTab
from table(:new.tab) o
) o
, table(o.innerTab) i;
end;
insert
into V_MY_OBJECT
values (
new TMyObject(
'A'
, TOuterNestedTable(
TInnerNestedTable('A','B','C')
, TInnerNestedTable('AA')
, TInnerNestedTable('AB')
insert
into V_MY_OBJECT
values (
new TMyObject(
'B'
, TOuterNestedTable(
TInnerNestedTable('X','Y','Z')
, TInnerNestedTable('Hello', 'World!')
/Selecting from the view shows the results:
select value(o)
from V_MY_OBJECT o
VALUE(O)(ID, TAB)
TMYOBJECT('A', TOUTERNESTEDTABLE(TINNERNESTEDTABLE('A', 'B', 'C'), TINNERNESTEDTABLE('AA'), TINNERNESTEDTABLE('AB')))
TMYOBJECT('B', TOUTERNESTEDTABLE(TINNERNESTEDTABLE('X', 'Y', 'Z'), TINNERNESTEDTABLE('Hello', 'World!')))
2 rows selected.Hope that helps...
Gerard -
Trigger on a paritioned table to insert into a non-paritioned table
Hi,
I have a partitioned table which will have a high degree of concurrent DMLs (Updates). It has a initrans value set to 16. On this table a trigger is created which will insert into a non-partitioned table on update of highly updateable columns. I am planning to keep the initrans value and freelists value to 16 so that it does not serialize and wait for the block slots.
Is the above set up performance inefficient? Is partitioning the table in which the trigger inserts will improve the performance?
Thanks,
RajeshI think if you want to consider an efficient solution, I would look at not implementing your requirements using triggers. If possible consider an API approach where whatever "applicaiton" is being used calls a PL/SQL package that will update both tables if necessary. There are a number of disadvantages to using triggers.
HTH!
Edited by: Centinul on Jan 2, 2009 11:48 PM
Check out this recent thread on triggers: Should one really avoid triggers??? -
Record not inserting into the table through Forms 10g
Hi all,
I have created a form in 10g(10.1.2.0.2) based on just one table that has 4 columns(col1, col2, col3, col4).
Here col1, col2 and col3 are VARCHAR2 and col4 is date and all the columns are not null columns(There are no primary and foriegn key constrains, which means duplicates are allowed).
My form contains 2 blocks where block 1 has one text item (col1) and 3 buttons (Delete, Save, Exit).
And block2 is a database block and has col2,col3,col4 which are in tabluar layout frame displaying 10 records.
When the form is opened the cursor has to be in block1.col1 for querrying. Here i enter a value in col1, and then when I click on col2 in the block2, then I put execute_query in new_block_instance of block2, which displays the records.
The block2 properties are not updatable, insertable and query is allowed.
Everything is working good until here. But here in the block2 when I want to insert another record into the table, by navigating all the way down to the last empty record and entering the new values for col2, col3 and col4 And then Ctrl+S will display the message "*FRM-40400: Transaction complete: 1 record applied and saved.*" But actually the record is not inserted into the table.
I also disabled the col4 by setting the Enabled property to No, since while inserting new record the date have to be populated into it and it shouldnt be changed by the user. And im populating the sysdate into the new record by setting Intial Value property to *$$DATE$$*.
And another requirement which I could not work arround here is that, the col3 also should be populated with the username of the user while inserting.
please help me...Hi Sarah,
I do not want to update the existing record. So I kept Udate Allowed to No in property palette for the items in block2.
Do I have to do this property at block level also?
I'm inserting a new record here.
Edited by: Charan on Sep 19, 2011 8:48 AM -
Avoiding duplicate records while inserting into the table
Hi
I tried the following insert statement , where i want to avoid the duplicate records while inserting itself
but giving me the errror like invalid identifier, though the column exists in the table
Please let me know Where i'm doing the mistake.
INSERT INTO t_map tm(sn_id,o_id,txt,typ,sn_time)
SELECT 100,
sk.obj_id,
sk.key_txt,
sk.obj_typ,
sysdate,
FROM S_KEY sk
WHERE sk.obj_typ = 'AY'
AND SYSDATE BETWEEN sk.start_date AND sk.end_date
AND sk.obj_id IN (100170,1001054)
and not exists (select 1
FROM t_map tm1 where tm1.O_ID=tm.o_id
and tm1.sn_id=tm.sn_id
and tm1.txt=tm.txt
and tm1.typ=tm.typ
and tm1.sn_time=tm.sn_time )Then
you have to join the table with alias tml where is that ?do you want like this?
INSERT INTO t_map tm(sn_id,o_id,txt,typ,sn_time)
SELECT 100,
sk.obj_id,
sk.key_txt,
sk.obj_typ,
sysdate,
FROM S_KEY sk
WHERE sk.obj_typ = 'AY'
AND SYSDATE BETWEEN sk.start_date AND sk.end_date
AND sk.obj_id IN (100170,1001054)
and not exists (select 1
FROM t_map tm where sk.obj_ID=tm.o_id
and 100=tm.sn_id
and sk.key_txt=tm.txt
and sk.obj_typ=tm.typ
and sysdate=tm.sn_time ) -
Commit for every 1000 records in Insert into select statment
Hi I've the following INSERT into SELECT statement .
The SELECT statement (which has joins ) has around 6 crores fo data . I need to insert that data into another table.
Please suggest me the best way to do that .
I'm using the INSERT into SELECT statement , but i want to use commit statement for every 1000 records .
How can i achieve this ..
insert into emp_dept_master
select e.ename ,d.dname ,e.empno ,e.empno ,e.sal
from emp e , dept d
where e.deptno = d.deptno ------ how to use commit for every 1000 records .ThanksSmile wrote:
Hi I've the following INSERT into SELECT statement .
The SELECT statement (which has joins ) has around 6 crores fo data . I need to insert that data into another table.Does the another table already have records or its empty?
If its empty then you can drop it and create it as
create your_another_table
as
<your select statement that return 60000000 records>
Please suggest me the best way to do that .
I'm using the INSERT into SELECT statement , but i want to use commit statement for every 1000 records .That is not the best way. Frequent commit may lead to ORA-1555 error
[url http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:275215756923]A nice artical from ASKTOM on this one
How can i achieve this ..
insert into emp_dept_master
select e.ename ,d.dname ,e.empno ,e.empno ,e.sal
from emp e , dept d
where e.deptno = d.deptno ------ how to use commit for every 1000 records .
It depends on the reason behind you wanting to split your transaction into small chunks. Most of the time there is no good reason for that.
If you are tying to imporve performance by doing so then you are wrong it will only degrade the performance.
To improve the performance you can use APPEND hint in insert, you can try PARALLEL DML and If you are in 11g and above you can use [url http://docs.oracle.com/cd/E11882_01/appdev.112/e25788/d_parallel_ex.htm#CHDIJACH]DBMS_PARALLEL_EXECUTE to break your insert into chunks and run it in parallel.
So if you can tell the actual objective we could offer some help. -
Problem inserting record using INSERT INTO
I am an amateur web builder using some ColdFusion functionality to access information on an Access database. I know very little about ColdFusion syntax, but I'm using Dreamweaver CS3 to help generate most of the code. I'm working on an insert record page to create a user database with login information. I'm not sure what the problem is, but I'm getting a syntax error referencing this particular portion of the code:
Syntax error in INSERT INTO statement.
The error occurred in C:\ColdFusion9\wwwroot\Everett\register.cfm: line 22
Below is the entire page with line 22 (referenced in the error message) in red. Any ideas?
<cfset CurrentPage=GetFileFromPath(GetBaseTemplatePath())>
<cfif IsDefined("FORM.MM_InsertRecord") AND FORM.MM_InsertRecord EQ "register">
<cfquery datasource="everettweb">
INSERT INTO Users ([First Name], [Last Name], [Email Address], Password)
VALUES (<cfif IsDefined("FORM.first_name") AND #FORM.first_name# NEQ "">
<cfqueryparam value="#FORM.first_name#" cfsqltype="cf_sql_clob" maxlength="255">
<cfelse>
</cfif>
, <cfif IsDefined("FORM.last_name") AND #FORM.last_name# NEQ "">
<cfqueryparam value="#FORM.last_name#" cfsqltype="cf_sql_clob" maxlength="255">
<cfelse>
</cfif>
, <cfif IsDefined("FORM.email") AND #FORM.email# NEQ "">
<cfqueryparam value="#FORM.email#" cfsqltype="cf_sql_clob" maxlength="255">
<cfelse>
</cfif>
, <cfif IsDefined("FORM.password") AND #FORM.password# NEQ "">
<cfqueryparam value="#FORM.password#" cfsqltype="cf_sql_clob" maxlength="255">
<cfelse>
</cfif>
</cfquery>
<cflocation url="register_success.cfm">
</cfif>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/Main.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<link href="main.css" rel="stylesheet" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Everett Music Department, Everett, MA</title>
<!-- InstanceEndEditable -->
<style type="text/css">
<!--
body {
background-color: #660000;
-->
</style>
<script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
<script type="text/javascript">
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
//-->
</script>
<!-- InstanceBeginEditable name="head" -->
<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
<script src="SpryAssets/SpryValidationConfirm.js" type="text/javascript"></script>
<link href="SpryAssets/SpryValidationConfirm.css" rel="stylesheet" type="text/css" />
<!-- InstanceEndEditable -->
<link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
a:link {
color: #660000;
a:visited {
color: #A01D22;
a:hover {
color: #FFCC00;
-->
</style>
<link href="main.css" rel="stylesheet" type="text/css" />
</head>
<body onload="MM_preloadImages('menu_about_over','menu_ensembles_over.jpg','menu_schools_over.j pg','menu_events_over.jpg','menu_faculty_over.jpg','menu_contacts_over.jpg','menu_home_ove r.jpg','menu_about_over.jpg','menu_links_over.jpg','menu_login_over.jpg')">
<table width="960" align="center" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="3"><img src="top_border.jpg" width="960" height="20" align="top" /></td>
</tr>
<tr align="center">
<td colspan="3"><a href="index.php"><img src="e_oval_top.jpg" height="100" width="270" border="0" /></a><a href="index.php"><img src="header.jpg" height="100" width="690" border="0" /></a></td>
</tr>
<tr>
<td height="35" width="301"><a href="index.php"><img src="e_oval_bottom.jpg" height="35" width="234" border="0" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('home','','menu_home_over.jpg',1)"><img src="menu_home.jpg" width="67" height="35" name="home" border="0" id="home" /></a></td>
<td width="251"><ul id="MenuBar1" class="MenuBarHorizontal">
<li><a class="MenuBarItemSubmenu" href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('about','','menu_about_over.jpg',1)"><img src="menu_about.jpg" width="71" height="35" name="about" border="0" id="about" /></a>
<ul>
<li><a href="#">News</a></li>
<li><a href="#">History</a></li>
<li><a href="#">Media</a></li>
</ul>
</li>
<li><a class="MenuBarHorizontal" href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('ensembles','','menu_ensembles_over.jpg',1)"><img src="menu_ensembles.jpg" width="98" height="35" name="ensembles" border="0" id="ensembles" /></a>
<ul>
<li><a href="#">Band</a></li>
<li><a href="#">Chorus</a></li>
<li><a href="#">Strings</a></li>
</ul>
</li>
<li><a class="MenuBarItemSubmenu" href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('schools','','menu_schools_over.jpg',1)"><img src="menu_schools.jpg" width="82" height="35" name="schools" border="0" id="schools" /></a>
<ul>
<li><a href="#">Everett High School</a></li>
<li><a href="#">English School</a></li>
<li><a href="#">Keverian School</a></li>
<li><a href="#">Lafayette School</a></li>
<li><a href="#">Parlin School</a></li>
<li><a href="#">Webster School</a></li>
<li><a href="#">Whittier School</a></li>
</ul>
</li>
</ul>
</td>
<td width="408"><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('events','','menu_events_over.jpg',1)"><img src="menu_events.jpg" width="74" height="35" name="events" border="0" id="events" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('faculty','','menu_faculty_over.jpg',1)"><img src="menu_faculty.jpg" width="79" height="35" name="faculty" border="0" id="faculty" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('links','','menu_links_over.jpg',1)"><img src="menu_links.jpg" width="66" height="35" name="links" border="0" id="links" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('login','','menu_login_over.jpg',1)"><img src="menu_login.jpg" name="login" width="69" height="35" border="0" id="login" /></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('contact','','menu_contact_over.jpg',1)"><img src="menu_contact.jpg" width="100" height="35" name="contact" border="0" id="contact" /></a><img src="menu_spacer_end.jpg" width="20" height="35" /></td>
</tr>
<tr height="10">
<td colspan="3"><img src="menu_bottom_spacer.jpg" height="10" width="960" /></td>
</tr>
</table>
<table width="960" cellpadding="0" cellspacing="0" align="center">
<tr height="50">
<td width="30" background="left_border.jpg"><img src="clear.gif" width="30" height="50" /></td>
<td width="900" bgcolor="#FFFFFF">
<table width="900" cellpadding="0" cellspacing="0">
<tr>
<td width="900" height="350" valign="top"><!-- InstanceBeginEditable name="PageBody" -->
<form action="<cfoutput>#CurrentPage#</cfoutput>" method="POST" name="register" preloader="no" id="register">
<table width="100%">
<tr>
<td colspan="2" class="heading1">Fill in the information below to register for this site:</td>
</tr>
<tr>
<td colspan="2"><img src="clear.gif" height="15" /></td>
</tr>
<tr>
<td width="50%" class="form" align="right">First Name:</td>
<td width="50%"><span id="sprytextfield1">
<input type="text" name="first_name" required="yes" id="first_name" width="150" typeahead="no" showautosuggestloadingicon="true" />
<span class="textfieldRequiredMsg">A value is required.</span></span></td>
</tr>
<tr>
<td class="form" align="right">Last Name:</td>
<td><span id="sprytextfield2">
<input type="text" name="last_name" required="yes" id="last_name" width="150" typeahead="no" showautosuggestloadingicon="true" />
<span class="textfieldRequiredMsg">A value is required.</span></span></td>
</tr>
<tr>
<td class="form" align="right">Email Address:</td>
<td><span id="sprytextfield3">
<input type="text" name="email" validate="email" required="yes" id="email" width="150" typeahead="no" showautosuggestloadingicon="true" />
<span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span></td>
</tr>
<tr>
<td class="form" align="right">Confirm Email Address:</td>
<td><span id="sprytextfield4"><span id="ConfirmWidget">
<input type="text" name="email_confirm" validate="email" required="yes" id="email_confirm" width="150" typeahead="no" showautosuggestloadingicon="true" />
<span class="confirmInvalidMsg">The values do not match</span></span></span></td>
</tr>
<tr>
<td class="form" align="right">Password:</td>
<td><span id="sprytextfield5">
<input type="password" name="password" required="yes" id="password" width="150" />
<span class="textfieldRequiredMsg">A value is required.</span></span></td>
</tr>
<tr>
<td class="form" align="right">Confirm Password:</td>
<td><span id="sprytextfield6"><span id="ConfirmWidget">
<input type="password" name="password_confirm" required="yes" id="password_confirm" width="150" />
<span class="confirmInvalidMsg">The values do not match</span></span></span></td>
</tr>
<tr>
<td> </td>
<td><input name="submit" type="submit" id="submit" value="Register" /></td>
</tr>
</table>
<input type="hidden" name="MM_InsertRecord" value="register" />
</form>
<script type="text/javascript">
<!--
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2");
var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3", "email");
var sprytextfield4 = new Spry.Widget.ValidationTextField("sprytextfield4", "email");
var sprytextfield5 = new Spry.Widget.ValidationTextField("sprytextfield5");
var sprytextfield6 = new Spry.Widget.ValidationTextField("sprytextfield6");
//-->
</script>
<script type="text/javascript">
var ConfirmWidgetObject = new Spry.Widget.ValidationConfirm("sprytextfield4", "email");
var ConfirmWidgetObject = new Spry.Widget.ValidationConfirm("sprytextfield6", "password");
</script>
<!-- InstanceEndEditable --></td>
</tr>
</table>
</td>
<td width="30" background="right_border.jpg"><img src="clear.gif" width="30" height="50" /></td>
</tr>
<tr>
<td colspan="3" background="footer.jpg" class="footer" height="80"/>This website best viewed using:<br /><a href="http://www.firefox.com"><img src="firefox_logo.gif" width="110" height="40" border="0" /></a></td>
</tr>
</table>
<script type="text/javascript">
<!--
var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"../SpryAssets/SpryMenuBarDownHover.gif", imgRight:"../SpryAssets/SpryMenuBarRightHover.gif"});
//-->
</script>
</body>
<!-- InstanceEnd --></html>Syntax error in INSERT INTO statement. INSERT INTO Users ([First Name], [Last Name], [Email Address], Password)
That oh-so-uninformative error is because "Password" is a reserved word with your database driver. Either escape it by putting square brackets around it too, or rename the column permanently. It is best to avoid using reserved words whenever possible. So renaming the column is the better option. Also, I would try and avoid using invalid characters like spaces in column names ie "First Name". It is technically allowed, but it requires special handling everywhere which adds unecessary complexity.
I'm not sure what the problem is, but I'm getting a syntax error referencing this particular portion of the code:
Do not take the error line numbers as gospel. Sometimes they just indicate that the error is within the vincinty of that line.
I'm using Dreamweaver CS3 to help generate most of the code
Unforutnately, DW wizards generate some truly awful and verbose code. To give you an idea, here is what the query should look like, without all the wizard nonsense.
<cfparam name="FORM.first_name" default="">
<cfparam name="FORM.last_name" default="">
<cfparam name="FORM.email" default="">
<cfparam name="FORM.FORM.password" default="">
<cfquery datasource="YourDSNName">
INSERT INTO Users ([First Name], [Last Name], [Email Address], [Password])
VALUES (
<cfqueryparam value="#FORM.first_name#" cfsqltype="cf_sql_varchar">
, <cfqueryparam value="#FORM.last_name#" cfsqltype="cf_sql_varchar">
, <cfqueryparam value="#FORM.email#" cfsqltype="cf_sql_varchar">
, <cfqueryparam value="#FORM.password#" cfsqltype="cf_sql_varchar">
</cfquery>
CF is pretty easy to learn. You might want to begin perusing the CF documentation and a few tutorials to get more familiar with the language. Since you are working with a database, I would also recommend a SQL tutorial. -
Second record not inserting into ztable
Hi All,
I have designed z table with following fields.
1) CONSULTANT
2) MODULE_NAME
3) CR_DATE
4) ISSUE
5) RPT_NAME
6) TCODE
7) REQ_NO
8) DEV_STA
9) QA_STA
10) PRD_STA.
the ztable contains no primaty key as we are storing the duplicates values
I have created One screen with all above fields using module pooled programming. One Input screen is designed containing all above fields. after that when i click on SAVE Button all above fields are getting inserted into ztable. But when i again fill the data the second record is not getting inserted into ztable.
I have written the following code for this :
wa_issue-CONSULTANT = ZISSUE-CONSULTANT.
wa_issue-MODULE_NAME = ZISSUE-MODULE_NAME.
wa_issue-CR_DATE = ZISSUE-CR_DATE.
wa_issue-ISSUE = ZISSUE-ISSUE.
wa_issue-RPT_NAME = ZISSUE-RPT_NAME.
wa_issue-TCODE = ZISSUE-TCODe.
wa_issue-REQ_NO = ZISSUE-REQ_NO.
wa_issue-DEV_STA = ZISSUE-DEV_STA.
wa_issue-QA_STA = ZISSUE-QA_STA.
wa_issue-PRD_STA = ZISSUE-PRD_STA.
insert into zissue values wa_issue .
commit work.Hi,
hcheck the key fields in the table
Regards,
V.Balaji
Reward if Usefull... -
Record not inserting into sap table with connector framework ?
here is the code, but record not being inserting into the table ... but same piece of code working fine while updating ... the record ...
try {
interaction = connection.createInteractionEx();
IInteractionSpec interactionSpec = interaction.getInteractionSpec();
String functionName = "Z_XYZ";
interactionSpec.setPropertyValue("Name", functionName);
String writingTable = "MYTABLE";
RecordFactory rf = interaction.getRecordFactory();
MappedRecord importParams = rf.createMappedRecord("input");
importParams.put("ATTR1", "VALUE1");
importParams.put("ATTR2", "VALUE2");
IFunction function = connection.getFunctionsMetaData().getFunction(functionName);
IStructureFactory sf = interaction.retrieveStructureFactory();
IRecordSet table = (IRecordSet) sf.getStructure(function.getParameter(writingTable).getStructure());
table.insertRow();
table.setString("ATNAME", "VALUE");
table.setString("ATWRT", "VALUE");
importParams.put(writingTable, table);
MappedRecord output = (MappedRecord) interaction.execute(interactionSpec, importParams);
} catch (Exception e) {
any idea?
than ks
MMKHi Mohan,
Does a creation through SE37 with the same input work?
Yoav. -
hi,guruvulu
this is the program...............to insert the data into sap r/3 table
but record is not inserting....any commit i have to write in my program?
Created on Feb 20, 2007
TODO To change the template for this generated file go to
Window - Preferences - Java - Code Style - Code Templates
package comm;
@author sapusr006
TODO To change the template for this generated type comment go to
Window - Preferences - Java - Code Style - Code Templates
Example2.java
Property of SAP AG, Walldorf
(c) Copyright SAP AG, Walldorf, 2000-2005.
All rights reserved.
//import java.sql.Connection;
//import java.sql.PreparedStatement;
import com.sap.mw.jco.IFunctionTemplate;
import com.sap.mw.jco.IRepository;
import com.sap.mw.jco.JCO;
@version 1.0
@author SAP AG, Walldorf
public class Fm {
// The MySAP.com system we gonna be using
static final String SID = "R3";
// static String query="insert into BAPI_COMPANYCODE_GETLIST values(?,?)";
// The repository we will be using
IRepository repository;
//ESTABLISHING A CONNECTION TO SAP
public Fm()
try {
JCO.addClientPool( SID, // Alias for this pool
10, // Max. number of connections
"800", // SAP client
"RFCTEST", // userid
"welcome", // password
"EN", // language
"10.10.88.170", // host name
"01" );
// Create a new repository
// The repository caches the function and structure definitions
// to be used for all calls to the system SID. The creation of
// redundant instances cause performance and memory waste.
repository = JCO.createRepository("MYRepository", SID);
catch (JCO.Exception ex) {
System.out.println("Caught an exception: \n" + ex);
// RETRIEVES AND DISPLAY A ZHR INFOTYPE OPERATION
public void salesOrders()
JCO.Client client = null;
try {
// Get a function template from the repository
//System.out.println("goes to sales order");
IFunctionTemplate ftemplate = repository.getFunctionTemplate("ZHR_INFOTYPE_OPERATION");
System.out.println("hai");
if(ftemplate != null) {
// Create a function from the template
JCO.Function function = ftemplate.getFunction();
JCO.ParameterList paralist=function.getImportParameterList();
paralist.setValue("0000000011","PERNR");
paralist.setValue("UPD","ACTIO");
paralist.setValue("A","TCLAS");
System.out.println("hello");
paralist.setValue("20061215","BEGDA");
System.out.println("hello");
paralist.setValue("20061215","ENDDA");
paralist.setValue("1","OBJPS");
paralist.setValue("LTA","SUBTY");
System.out.println("SETTING VALUES");
// Get a client from the pool
client = JCO.getClient(SID);
System.out.println("goes to sales order");
//function.getImportParameterList().setValue("QUERY_TABLE","ZHRJ2EETEST");
//EXECUTING THE FUNCTION
client.execute(function);
System.out.println("after exeucting the function");
// NO OF IMPORT PARAMS IT DISPLAY
//STRUCTURE
JCO.Structure returnStructure =
function.getExportParameterList().getStructure("RETURN");
String structure=returnStructure.toString();
System.out.println(structure);
JCO.Table sales_orders = function.getTableParameterList().getTable("PROPOSED_VALUES");
System.out.println("after function");
System.out.println("proposed111"+sales_orders.getNumRows());
sales_orders.firstRow();
sales_orders.appendRows(3);
sales_orders.setValue("0582","INFTY");
sales_orders.setValue("P0582-AMTEX","FNAME");
sales_orders.setValue("200.00","FVAL");
sales_orders.nextRow();
sales_orders.setValue("0582","INFTY");
sales_orders.setValue("P0582-JBGDT","FNAME");
sales_orders.setValue("20061215","FVAL");
sales_orders.nextRow();
sales_orders.setValue("0582","INFTY");
sales_orders.setValue("P0582-JENDT","FNAME");
sales_orders.setValue("20061215","FVAL");
System.out.println("proposed222"+sales_orders.getNumRows());
/*for (int i = 0; i <sales_orders.getNumRows(); i++) {
sales_orders.setRow(i);
System.out.println(sales_orders.getString("INFTY"));
JCO.Table sales_orders1 = function.getTableParameterList().getTable("MODIFIED_KEYS");
System.out.println("modified"+sales_orders1.getNumRows());
sales_orders1.setRow(1);
sales_orders1.appendRows(1);
sales_orders1.setValue("0000000011","PERNR");
sales_orders1.setValue("0582","INFTY");
sales_orders1.setValue("LTA","SUBTY");
sales_orders1.setValue("1","OBJPS");
sales_orders1.setValue("20061215","BEGDA");
sales_orders1.setValue("20061215","ENDDA");
System.out.println("modified222"+sales_orders1.getNumRows());
System.out.println("execute222"+sales_orders1.getNumRows());
for (int i = 0; i <sales_orders1.getNumRows(); i++) {
sales_orders.setRow(i);
System.out.println("hia"+sales_orders1.getString("SUBTY"));
System.out.println("NO OF ROWS ARE:---"+ sales_orders.getNumRows());
String fieldName[]=new String[sales_orders.getFieldCount()];
System.out.println("THE COLUMNS IN THE TABLE ARE:--"+sales_orders.getFieldCount());
// sales_orders.firstRow();
//COLUMNS NAMES
System.out.println(fieldName.length);
for (int iCtrst = 0;iCtrst < sales_orders1.getFieldCount();iCtrst++) {
fieldName[iCtrst] = sales_orders1.getName(iCtrst);
System.out.println(fieldName[iCtrst]);
if (sales_orders.getNumRows() > 0) {
// Loop over all rows
do {
System.out.println("----
//int r=1;
// Loop over all columns in the current row
for (JCO.FieldIterator e = sales_orders.fields(); e.hasMoreElements();)
JCO.Field field = e.nextField();
String compcode=field.getString();
//pst.setString(r,compcode);
System.out.println(field.getName() + ":\t" + field.getString());
// r++;
}//for
// i=pst.executeUpdate();
} while(sales_orders.nextRow());
else {
System.out.println("No results found");
if (sales_orders1.getNumRows() > 0) {
// Loop over all rows
do {
System.out.println("----
//int r=1;
// Loop over all columns in the current row
for (JCO.FieldIterator e = sales_orders1.fields(); e.hasMoreElements();)
JCO.Field field1 = e.nextField();
//String compcode=field1.getString();
//pst.setString(r,compcode);
System.out.println(field1.getName() + ":\t" + field1.getString());
// r++;
}//for
// i=pst.executeUpdate();
} while(sales_orders1.nextRow());
else {
System.out.println("No results found");
System.out.println("modified"+sales_orders1.getNumRows());
System.out.println("modified"+sales_orders.getNumRows());
//if
/* if(i>=1)
System.out.println("\t\t\tUpdated ORACLE successfully");
else {
System.out.println("FUNCTION MODULE not found in backend system.");
}//if
catch (JCO.AbapException ex) {
System.out.println("Caught an exception: \n" + ex);
}catch(Exception en){en.printStackTrace();}
finally {
JCO.releaseClient(client);
protected void cleanUp() {
JCO.removeClientPool(SID);
public static void main(String[] argv)
Fm e=new Fm();
// e.systemInfo();
e.salesOrders();
e.cleanUp();
output:
TABLE: MODIFIED_KEYS
TABLE: PROPOSED_VALUES
IMPORT ACTIO
IMPORT BEGDA
IMPORT DIALOG_MODE
IMPORT ENDDA
IMPORT LUW_MODE
IMPORT MASSN
IMPORT NO_ENQUEUE
IMPORT NO_EXISTENCE_CHECK
IMPORT OBJPS
IMPORT PERNR
IMPORT PERSG
IMPORT PERSK
IMPORT PLANS
IMPORT SEQNR
IMPORT SPRPS
IMPORT SUBTY
IMPORT TCLAS
IMPORT WERKS
EXPORT HR_RETURN
EXPORT RETURN
EXPORT RETURN1
appending
NO OF ROWS ARE:---3
THE COLUMNS IN THE TABLE ARE:--4
INFTY: 0582
FNAME: P0582-AMTEX
FVAL: 200.00
SEQNR: 00
INFTY: 0582
FNAME: P0582-JBGDT
FVAL: 20061215
SEQNR: 00
INFTY: 0582
FNAME: P0582-JENDT
FVAL: 20061215
SEQNR: 00
PERNR: 00000011
INFTY: 0582
SUBTY: LTA
OBJPS: 1
SPRPS:
ENDDA: 2006-12-15
BEGDA: 2006-12-15
SEQNR: 000hi jagadesh,
ur code is very length to see.
see the following code ,
JCO.Function objFunction =
this
.objIRepository
.getFunctionTemplate("BAPI_MATERIAL_AVAILABILITY")
.getFunction();
objFunction.getImportParameterList().setValue(strPlant, "PLANT");
objFunction.getImportParameterList().setValue(strMaterial, "MATERIAL");
objFunction.getImportParameterList().setValue(strQuantity, "UNIT");
this.objClient.execute(objFunction);
JCO.Structure ret =
objFunction.getExportParameterList().getStructure("RETURN");
String strRetMsg = ret.getString("MESSAGE");
System.out.println(strRetMsg); // it will tell whether record is inserted or not
/*JCO.Function objFunction1 =
this
.objIRepository
.getFunctionTemplate("BAPI_TRANSACTION_COMMIT")
.getFunction();
objFunction1.setValue("",WAIT);
objClient.execute(objFunction1);*/
CHECK THE RETURN MSG .IT WILL TELL THE PROBLEM
give me points if it is useful
regards
Guru
Message was edited by:
Guruvulu Bojja
Message was edited by:
Guruvulu Bojja
Message was edited by:
Guruvulu Bojja -
Data from 2 database blocks insert into the same base table?
Hello,
I have canvas C_NEW. On this canvas, items from 3 blocks are usable by the user.
1. Block NEW_HEAD: 3 items say X1,X2,X3
2. Block NEW : multi record text fields say Y1 thru Y10. Also a scrollbar.
3. Block NEW_ACTION: 6 buttons say B1 thru B6 (One of them is N_OK which is the item in question)
both the blocks NEW, NEW_HEAD are db blocks and have the same base table say BT. When the users click on the N_OK (after filling out the data in the NEW_HEAD block and then NEW in that order) I need the data from both the NEW, NEW_HEAD to go into the BT. Currently only the data from the NEW is going into BT. Fields in the BT table which correspond to the fields X1,X2,X3 in the NEW_HEAD remain null after clicking the N_OK button. I put commit_form in the N_OK code since both the blocks are db blocks( and as suggested by folks, it is easier to issue a commit_form than do a lot more work in writing my own SQL).
How can I achive this?
Thanks,
ChiruI tried doing what you suggested by putting the following code in the program unit which gets called when_button_pressed.
PROCEDURE P_SAVE IS
v_lc_no number;
v_lc_seq number;
v_dmg_allow number;
BEGIN
Go_Block('B_new_head');
v_lc_no:= :B_new_head.N_LC_NO;
v_lc_seq:= :B_new_head.N_LC_SEQ;
v_dmg_allow:= :B_new_head.N_LC_DMG_ALLOW;
Go_Block('B_new');
FIRST_RECORD;
LOOP
emessage('before insert'||v_lc_no||'-'||v_lc_seq||'-'||:B_new.order_no);
INSERT INTO ct_lc_import(
LC_NUMBER,
LC_SEQ,
DAMAGE_ALLOWANCE,
ORDER_NO,
QTY_SHIPPED,
UNIT_PRICE,
DRAFT_AMOUNT,
TICKET_DEDUCTION,
SHIPMENT_PENALTY,
TOTAL_DEBIT,
DEBIT_DATE)
VALUES (v_lc_no,
v_lc_seq,
v_dmg_allow,
:B_new.order_no,
:B_new.qty_shipped,
:B_new.unit_price,
:B_new.draft_amount,
:B_new.ticket_deduction,
:B_new.shipment_penalty,
:B_new.total_debit,
:B_new.debit_date);
commit;
NEXT_RECORD;
if :SYSTEM.LAST_RECORD='TRUE' then
emessage('last record');
EXIT;
end if;
--NEXT_RECORD;
END LOOP;
EXCEPTION
when FORM_TRIGGER_FAILURE then
raise;
when OTHERS then
emessage(SQLERRM);
raise FORM_TRIGGER_FAILURE;
END;But I can't see the records in the table eventhough the message pops up with the values before inserting the 1st record. It then exits. I would think it would atleast insert the very first record into the the table at the least.
Thanks,
Chiru -
How do i insert into more than one table from temp table?
Hi,
I have three tables such as temp,stck and stol
temp table contains data as below. It has 22 columns.
STOCK STOCKDESC ALIAS1 ALIAS2 ALIAS3 ALIAS4 ALIAS5 ALIAS6 ALIAS7 ALIAS8 ALIAS9 ALIAS10 ALIAS11 ALIAS12 ALIAS13 ALIAS14 ALIAS15 ALIAS16 ALIAS17 ALIAS18 ALIAS19 ALIAS20
bmg667691031 NOWE FINANSE LTD yy zz B282DV3 TESTICKER te te1 bmg667691031BM te 707943W ex IR-PRIME IR-ALTID IR-BLOOM NT-PRIME NT-ALTID NT-BLOOM AU-PRIME AU-ALTID AU-BLOOM mm
AA0098000181 UFACEX HOLDINGS VAR RT DUE 06-30-2010 kk yy mm TESTICKER aa ff AA0098000181GB bb 031969W cc IR-PRIME IR-ALTID IR-BLOOM NT-PRIME NT-ALTID NT-BLOOM AU-PRIME AU-ALTID AU-BLOOM ba
AC1350Z7M923 CDA GOVT TREAS BILLS CDS- 08-05-2010 ee ff gg TESTICKER hh ij AC1350Z7M923CA mn 1A1MTLU op IR-PRIME IR-ALTID IR-BLOOM NT-PRIME NT-ALTID NT-BLOOM AU-PRIME AU-ALTID AU-BLOOM op
stck table contains as below.It has six columns. But always first three columns will have values.
stock_id stock_code stock_description stock_type terriory_code preferred code
1185072 AED
1185073 ARA CURRENCY ARGENTINA PESO
1185074 ATS CURRENCY AUSTRIAN SCHS
stol table contains as below. It has 6 columns.Terriory_code is always empty.
stock_code territory_code stol_type stock_id stck_code_type sys_entry_date
AED 0 1185072 0 6/22/2007 3:59:13.000 PM
ARA 0 1185073 0 6/22/2007 3:59:13.000 PM
ATS 0 1185074 0 6/22/2007 3:59:13.000 PM
Now, i want to insert into stck and stol table based on temp table records. constraints to insert into stck and stol tables are as below
In temp table first column is called stock. This stock has to compare with stck table stock_code. If it is not present in stck table, then it has to insert into stck table with stock_id and stock_description. Here, I need to generate stock_id my self in the code.
In temp table, column 3 to column 22, i have alias. Each column has to check with stol table stock_code column. For instance, column3 check with stock_code column. Then column4 check with stock_code. If stock_code is not present in stol table, then i have to insert into stol table.
I need to generate stock,id in the code. How do i perform this insertion?
Edited by: user12852882 on Jun 12, 2010 2:37 AMIt can be done using SQL (no loops required)
insert into stock_table (stock_id,stock_code,stock_description)
select stock_id,get_stock_code,stockdesc /* get_stock_code is a function providing stock_code - usually a sequence value */
from (select t.stock stock_id,t.stockdesc,s.stock_id stock_stock_id
from temp_table t,stock_table s
where t.stock = s.stock_id(+)
where s.stock_id is null;
insert into stol_table (stock_code,sys_entry_date) /* not clear where other values to be inserted will come from */
select stock_code,sysdate
from (select t.stock_code,s.stock_code stol_stock_code
from (select distinct stock_code
from (select alias1 stock_code from temp_table union all
select alias2 from temp_table union all
select alias3 from temp_table union all
select alias4 from temp_table union all
select alias5 from temp_table union all
select alias6 from temp_table union all
select alias7 from temp_table union all
select alias8 from temp_table union all
select alias9 from temp_table union all
select alias10 from temp_table union all
select alias11 from temp_table union all
select alias12 from temp_table union all
select alias13 from temp_table union all
select alias14 from temp_table union all
select alias15 from temp_table union all
select alias16 from temp_table union all
select alias17 from temp_table union all
select alias18 from temp_table union all
select alias19 from temp_table union all
select alias20 from temp_table
) /* use unpivot instead if you are 11g */
where stock_code is not null
) t,stol_table s
where t.stock_code = s.stock_code(+)
where s.stock_code is null;
and think about damorgan's post, you'll never regret it (especially when you will not just think)
Regards
Etbin
Maybe you are looking for
-
Hp 7500 all in one - not picking up paper
I have cleaned the paper rollers and it still won't feed paper through
-
Hi Folks, can any body please give some input on the follwoing. i want to display material created by and material created on for each material based on material selection from selction screen dynamically. like s_mat = 1, 2,3. o/p must be mat1 |crete
-
Cannot edit table in Assignment
After placing a table into an Indesign CS2 document I turned the document into an assignment and I cannot edit that table in the assignment. I need to figure out a way to edit it in the assignment. The table is locked when it is in the Assignment (i.
-
IE8 and smart select compatability
Why is there no fix for this problem? Surely Microsoft and/or HP care.
-
Integrate OAS Portal with E1 - WSRP Producer
Hello, I want to integrate OAS Portal with E1. I am following: "JD Edwards EnterpriseOne Tools Release 8.98 Portal Reference Guide for All Portals and Platforms" and I have a doubt about how to register a new WSRP producer for Oracle Portal Server. I