Problem inserting records in table using cursors
hi all
i have a block in which i m trying to take records from a table pass it to a procedure which in turn calls some procedures
and than the procesed records are dumped into another table
this is my code
set serveroutput on
declare
lastcall date;
srcip varchar2(50);
username varchar2(50):='9204';
duration number;
callto varchar2(50);
accountid varchar2(50);
calltime date;
subscriberid varchar2(50);
country varchar2(50);
cost varchar2(50);
CURSOR process_cdr
IS
SELECT
srcip,
username,
callto,
calltime,
duration
FROM rawcdr
WHERE calltime>lastcall;
begin
select max(calltime_gmt) into lastcall from
processed_cdr;
open process_cdr;
fetch process_cdr into srcip,username,callto,calltime,duration;
dbms_output.put_line(callto);
if (instr(callto,'00')=5) then
callto:=SUBSTR(REPLACE(callto,SUBSTR(callto, INSTR(callto, '@'), 50), ''), INSTR(callto, ':') + 3, 50);
dbms_output.put_line(callto);
elsif (instr(callto,'011')=5) then
callto:=SUBSTR(REPLACE(callto, SUBSTR(callto, INSTR(callto, '@'), 50), ''), INSTR(callto, ':') + 4, 50);
dbms_output.put_line(callto);
else
callto:=SUBSTR(REPLACE(callto, SUBSTR(callto, INSTR(callto, '@'), 50), ''), INSTR(callto, ':') +1 , 50);
end if;
process_call(srcip,username,duration,callto,accountid,subscriberid,country,cost);
dbms_output.put_line(cost);
dbms_output.put_line('trying to insert');
insert into processed_cdr values(accountid,subscriberid,srcip,username,callto,country,calltime,duration,cost) ;
dbms_output.put_line('inserted successfully');
FETCH process_cdr INTO srcip, username, callto, calltime, duration;
close process_cdr;
end;
now the problem is that
records are not getting inserted nor an error is shown
i guess i m not that much familiar with cursors
and thats creating prob
please help
Hallo,
but you haven't a loop ! :-)
Try this,
(not tested)
set serveroutput on
declare
lastcall date;
srcip varchar2(50);
username varchar2(50):='9204';
duration number;
callto varchar2(50);
accountid varchar2(50);
calltime date;
subscriberid varchar2(50);
country varchar2(50);
cost varchar2(50);
CURSOR process_cdr
IS
SELECT
srcip,
username,
callto,
calltime,
duration
FROM rawcdr
WHERE calltime>lastcall;
begin
select max(calltime_gmt) into lastcall from
processed_cdr;
open process_cdr;
LOOP
fetch process_cdr into srcip,username,callto,calltime,duration;
EXIT WHEN process_cdr%NOTFOUND;
dbms_output.put_line(callto);
if (instr(callto,'00')=5) then
callto:=SUBSTR(REPLACE(callto,SUBSTR(callto, INSTR(callto, '@'), 50), ''), INSTR(callto, ':') + 3, 50);
dbms_output.put_line(callto);
elsif (instr(callto,'011')=5) then
callto:=SUBSTR(REPLACE(callto, SUBSTR(callto, INSTR(callto, '@'), 50), ''), INSTR(callto, ':') + 4, 50);
dbms_output.put_line(callto);
else
callto:=SUBSTR(REPLACE(callto, SUBSTR(callto, INSTR(callto, '@'), 50), ''), INSTR(callto, ':') +1 , 50);
end if;
process_call(srcip,username,duration,callto,accountid,subscriberid,country,cost);
dbms_output.put_line(cost);
dbms_output.put_line('trying to insert');
insert into processed_cdr values(accountid,subscriberid,srcip,username,callto,country,calltime,duration,cost) ;
dbms_output.put_line('inserted successfully');
/* Second fetch is not needed
--FETCH process_cdr INTO srcip, username, callto, calltime, duration; */
END LOOP;
close process_cdr;
COMMIT; -- eventually
end;You didn't answered - do you do COMMIT elsewhere ?
I placed COMMIT also, if you don't need it, you can comment it
Regards
Dmytro
Similar Messages
-
How to insert record in table using ADF Table
Hi,
I am developing and application in ADF .it consist 5 tables.i need to insert into 1 table that contains IDs that are reffered from other tables and on ADF Table fi i dont want to show those IDs. Can somebody provide me solution how to do that?
like i have a SkillTable - that contains attributes Resource No(number) ,module Id(number), Track id(number), skill_type(number), skill_rating(number), experience(number).
Track id is reffered from track table
Module id is reffered from module table
Resource table is reffered from resource table
skill_type and skill_rating from lookup table
and i need to insert into SkillTable using ADF Table. we dont want to show Track id,module id,codes for skill_type nad skill_rating on ADF Table instead we want to show trackname and module name ,code values for skill_type and Skill_rating .
when we create ADF table for this skill table it shows me ids but what i want is that in each row it should show resource name,modulename,track name,and for skill_type and skill_rating it should show name of skill_types and Skill_rating rather than codes for each skill_type and Skill_rating.
we tried to insert by creating view ,but didnot work.
plz provide any solution.
ThnaklsHi,
Thanks for quick reply.but let me tell u my problem in more detail.
To insert into skill_table I have created a VO that contains ResourceNo, track_id, module_id,skill_type,skill_rating,experience. And I drag it on ADF creation form and also have created read only LOV for resource_name from resorce_table, LOV for skill_type,skill_rating from Lookup table,
And mapped those LOV to resource_no,skill_type,skill_rating on insert page.
For track_id I have converted inputtextBox to SelectinputText to create databound LOV which will popup a window that contain master detail for track_table and module_table which shows all track_names in master and corresponding module_names in detail table, and on that window I have select button when we click that button selected track_id and selected module_id will get populated to insert skill page in track_id selectinputtextbox and module_Id inpiuttextbox.
Now what I want is that instead of track_id and module_id populated on insert page coz these are of id's actually and we want to show values of these id's from other tables, I need to show selected track_name and module_name over on insert page.
Not getting any idea how to do that???
Plz help. -
Problem inserting rows to table using BPEL workflow
Hi,
I’m going to invoke below procedure which is inside a package.
PROCEDURE as_ebs_status_msg(getData in varchar) AS
BEGIN
insert into AS_AP_INV_STATUS_IPM values('BP1234','BP1234','BP1234');
END as_ebs_status_msg;
Once I invoke this procedure from sql developer (Using execute command) it inserts those values to the table.
But when I invoke this from a BPEL work flow (adding partner link) it completes without any error. But values are not getting populated to the table.
And I tried to use Insert functionality of DB adapter, that is also not inserting values to any table but I can run select queries.
Is anyone came across this issue?
Thank You,
any response greatly appreciated.......
Edited by: Nir on Aug 31, 2011 10:47 PMHallo,
but you haven't a loop ! :-)
Try this,
(not tested)
set serveroutput on
declare
lastcall date;
srcip varchar2(50);
username varchar2(50):='9204';
duration number;
callto varchar2(50);
accountid varchar2(50);
calltime date;
subscriberid varchar2(50);
country varchar2(50);
cost varchar2(50);
CURSOR process_cdr
IS
SELECT
srcip,
username,
callto,
calltime,
duration
FROM rawcdr
WHERE calltime>lastcall;
begin
select max(calltime_gmt) into lastcall from
processed_cdr;
open process_cdr;
LOOP
fetch process_cdr into srcip,username,callto,calltime,duration;
EXIT WHEN process_cdr%NOTFOUND;
dbms_output.put_line(callto);
if (instr(callto,'00')=5) then
callto:=SUBSTR(REPLACE(callto,SUBSTR(callto, INSTR(callto, '@'), 50), ''), INSTR(callto, ':') + 3, 50);
dbms_output.put_line(callto);
elsif (instr(callto,'011')=5) then
callto:=SUBSTR(REPLACE(callto, SUBSTR(callto, INSTR(callto, '@'), 50), ''), INSTR(callto, ':') + 4, 50);
dbms_output.put_line(callto);
else
callto:=SUBSTR(REPLACE(callto, SUBSTR(callto, INSTR(callto, '@'), 50), ''), INSTR(callto, ':') +1 , 50);
end if;
process_call(srcip,username,duration,callto,accountid,subscriberid,country,cost);
dbms_output.put_line(cost);
dbms_output.put_line('trying to insert');
insert into processed_cdr values(accountid,subscriberid,srcip,username,callto,country,calltime,duration,cost) ;
dbms_output.put_line('inserted successfully');
/* Second fetch is not needed
--FETCH process_cdr INTO srcip, username, callto, calltime, duration; */
END LOOP;
close process_cdr;
COMMIT; -- eventually
end;You didn't answered - do you do COMMIT elsewhere ?
I placed COMMIT also, if you don't need it, you can comment it
Regards
Dmytro -
Is it possible to add records to tables using Enterprise Manager?
Can we add records to tables using Oracle Enterprise Manager web interface instead of the sqlplus commands ? if not, is there any easy way to insert data into table using a graphical interface?
You may consider using iSQL*Plus.
Check http://www.oracle.com/technology/obe/obe10gdb/install/isqlplus/isqlplus.htm
Thanks, -
How to pick max value from a column of a table using cursor and iteration
Hello Everybody
I have a table loan_detail
and a column in it loan_amount
now i want to pick values from this table using cursor and then by using iteration i want to pick max value from it using that cursor
here is my table
LOAN_AMOUNT
100
200
300
400
500
5600
700i was able to do it using simple loop concepts but when i was trying to do this by using cursor i was not able to do it .
Regards
PeeyushSQL> SELECT MAX(sal) Highest_Sal,MIN(sal) Lowest_Sal FROM emp;
HIGHEST_SAL LOWEST_SAL
5000 800
SQL> set serverout on
SQL> DECLARE
2 TYPE tmp_tbl IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
3 sal_tbl tmp_tbl;
4 CURSOR emp_sal IS
5 SELECT sal FROM emp;
6 counter INTEGER := 1;
7 BEGIN
8 FOR i IN emp_sal LOOP
9 sal_tbl(i.sal) := counter;
10 counter := counter + 1;
11 END LOOP;
12 DBMS_OUTPUT.put_line('Lowest SAL:' || sal_tbl.FIRST);
13 DBMS_OUTPUT.put_line('Highest SAL:' || sal_tbl.LAST);
14 END;
15 /
Lowest SAL:800
Highest SAL:5000
PL/SQL procedure successfully completed.
SQL> Even smaller
SQL> DECLARE
2 TYPE tmp_tbl IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
3 sal_tbl tmp_tbl;
4 CURSOR emp_sal IS
5 SELECT sal FROM emp;
6 counter INTEGER := 1;
7 BEGIN
8 FOR i IN emp_sal LOOP
9 sal_tbl(i.sal) := 1;
10 END LOOP;
11 DBMS_OUTPUT.put_line('Lowest SAL:' || sal_tbl.FIRST);
12 DBMS_OUTPUT.put_line('Highest SAL:' || sal_tbl.LAST);
13 END;
14 /
Lowest SAL:800
Highest SAL:5000
PL/SQL procedure successfully completed.
SQL> Edited by: Saubhik on Jan 5, 2011 4:41 PM -
Can select, but cannot insert into oracle tables using php.
I am having trouble inserting data into a tables in oracle using PHP. I can insert into the tables using baninst1, but nothing else. I can't even insert using the tables' owner. Every time I try I get the ORA-00492 error of table or view does not exist. However, I can run a select statement just fine. So far, baninst1 is the only user that can actually do inserts. I've triple checked all the table grants and everything is fine. Also, I can copy/paste the exact insert statement into SQL*Plus and it works with the correct user. It doesn't have to be baninst1. I've tried everything I can think of. I've tried putting the table name in quotes, adding the schema name to the table, checking public synonyms, but everything appears to be ok. I would greatly appreciate any suggestions others may have.
I'm using PHP 5.2.3 with an oracle 9i DB.Here is the code that doesn't work. It works only with baninst1, no other username will work and all I do is change the my_username/my_password to something different. This is one example function where I try to do an insert, but it doesn't work on any of the tables I try.
Thanks for looking.
class Oracle {
private $oracleUser = "my_username";
private $oraclePassword = "my_password";
private $oracleDB = "MY_DB";
private $c = null;
function Connect() {
if ( !($this->c = ocilogon( $this->oracleUser, $this->oraclePassword, $this->oracleDB ) ) )
return false;
return true;
function AddNewTest($testName, $course, $section, $term, $maxAttempts, $length, $startDate, $startTime, $endDate, $endTime)
$result = "";
if( $this->c == null )
$this->Connect();
$splitIndex = strpos($course, " ");
$subjectCode = substr($course, 0, $splitIndex);
$courseNumber = substr($course, $splitIndex + 1);
$insertStatment = "insert into szbtestinfo(szbtestinfo_test_name,
szbtestinfo_course_numb,
szbtestinfo_section,
szbtestinfo_max_attempts,
szbtestinfo_length_minutes,
szbtestinfo_start,
szbtestinfo_end,
szbtestinfo_id,
szbtestinfo_subj_code,
szbtestinfo_eff_term)
values( '" . $testName .
"', '" . $courseNumber .
"', '" . $section .
"', " . $maxAttempts .
", " . $length .
", to_date('" . $startDate . " " . $startTime . "', 'MM/DD/YYYY HH24:MI')" .
", to_date('" . $endDate . " " . $endTime . "', 'MM/DD/YYYY HH24:MI')" .
", szsnexttest.nextval" .
", '" . $subjectCode .
"', '" . $term . "')";
//return $insertStatment;
$s = OCIParse($this->c, $insertStatment);
try
$result = OCIExecute($s);
catch(exception $e)
return $result;
} -
Problem in accessing mseg table using MSEG~M Index.
Hi Experts,
I am facing problem in accessing mseg table using MSEG~M Index. I used same sequence of fields and i tried with mandt field also. but it is not taking the Index and it is going for TImeout ABAP dump.
This are my codes used in different ways
1. SELECT mjahr
bwart
matnr
lifnr
dmbtr
kostl
aufnr
bukrs
FROM mseg CLIENT SPECIFIED INTO TABLE t_mseg2
WHERE mandt EQ sy-mandt AND
matnr NE SPACE AND
werks EQ p_werks AND
lgort NE '0000' AND
bwart IN (122,201,262) AND
sobkz NE '0'
%_HINTS ORACLE 'INDEX("MSEG" "MSEG~M")'.
2. SELECT mjahr
bwart
matnr
lifnr
dmbtr
kostl
aufnr
bukrs
FROM mseg INTO TABLE t_mseg2
WHERE matnr NE SPACE AND
werks EQ p_werks AND
lgort NE '0000' AND
bwart IN (122,201,262) AND
sobkz NE '0'
%_HINTS ORACLE 'INDEX("MSEG" "MSEG~M")'.
3. SELECT mjahr
bwart
matnr
lifnr
dmbtr
kostl
aufnr
bukrs
FROM mseg INTO TABLE t_mseg2
WHERE matnr NE SPACE AND
werks EQ p_werks AND
lgort NE '0000' AND
bwart IN (122,201,262) AND
sobkz NE '0'.
The above all code is not at all taking the index in Quality server .but in Development it is taking .In Quality server it is reading all datas without using the index and going Timeout ABAP dmup
Please, Suggest me some solutions.
Thanks in Advance.
Regards,
NandhaHi,
Without NE also not working out. i am facing same problem still.
SELECT bwart
matnr
lifnr
dmbtr
kostl
aufnr
FROM mseg CLIENT SPECIFIED INTO TABLE t_mseg
WHERE mandt EQ sy-mandt AND
werks EQ p_werks AND
bwart IN (122,201,262) AND
mjahr EQ p_year AND
bukrs EQ p_cc
%_HINTS ORACLE 'INDEX("MSEG" "MSEG~M")'.
Please,check and help me out from this issue.
Regards,
Nandha -
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. -
Problem - Inserting Records into Hashed Tables
Help for an ABAP Newbie...
How do I insert records into a hashed table?
I am trying the following, but get the error message,
*You cannot use explicit or implicit index operations with types "HASHED TABLE" or "ANY TABLE". "LT_UNIQUE_NAME_KEYS" has the type "HASHED TABLE".
TYPES: BEGIN OF idline,
id TYPE i,
END OF idline.
DATA: lt_unique_name_keys TYPE HASHED TABLE OF idline WITH UNIQUE KEY id,
ls_unique_name_key LIKE LINE OF lt_unique_name_keys.
" Create a record and attempt to insert it into the internal table.
" Why does this cause a compilation error message?
ls_unique_name_key-id = 1.
INSERT ls_unique_name_key INTO lt_unique_name_keys.
Thanks,
WalterINSERT ls_unique_name_key INTO TABLE lt_unique_name_keys.
-
Unable to insert the record to table using pre-insert & pre-update trigger
Hi All,
I have tried to insert and update the backend table using the pre-update and pre-insert triggers. But its not working for me. Please find below the code which i have used in the triggers.
Pre-insert trigger:
DECLARE
v_cust_num_cnt NUMBER;
BEGIN
SELECT COUNT(customer_number)
INTO v_cust_num_cnt
FROM cmw_bc_mobile_number
WHERE substr(customer_number,1,15)=substr(:BLOCKNAME.CUSTOMER_NUMBER,1,15);
IF v_cust_num_cnt = 0 THEN
INSERT INTO cmw_bc_mobile_number (CUSTOMER_NUMBER
,MOBILE_NUMBER
,CREATION_DATE
VALUES
(substr(:BLOCKNAME.CUSTOMER_NUMBER,1,15)
,:BLOCKNAME.MOBILE_NUMBER
,SYSDATE
COMMIT;
END IF;
END;
PRE_UPDATE TRIGGER:
BEGIN
IF :SYSTEM.RECORD_STATUS = 'CHANGED' THEN
UPDATE apps.cmw_bc_mobile_number
SET mobile_number = :BLOCKNAME.MOBILE_NUMBER,
creation_date = SYSDATE
WHERE customer_number=substr(:BLOCKNAME.CUSTOMER_NUMBER,1,15);
COMMIT;
END IF;
EXCEPTION
WHEN OTHERS THEN
NULL;
END;
Please let someone assist in gettting it resolved.
Regards,
Raj.Just use MESSAGE (we don't know what fnd_message is, that is some custom code):
message('v_cust_num_cnt='||v_cust_num_cnt);
IF v_cust_num_cnt = 0 THEN
message('Now inserting...');
INSERT INTO cmw_bc_mobile_number (CUSTOMER_NUMBER...
else
message('Nothing to insert');
end if; -
Validations when inserting records into database using table control?
hi , guru's.
iam inserting records into database table through table control when i press insert i want check which record is existing and which is not . so please give me any sample code
regards,
satheesh.hi , arjun.
please check this code.
WHEN 'INSERT'.
data: g_vcontrol_itab1 like table of zcust_call_rec,
g_vcontrol_wa1 like g_vcontrol_wa.
SELECT * FROM zcust_call_rec
INTO CORRESPONDING FIELDS OF TABLE g_vcontrol_itab1
FOR ALL ENTRIES IN g_vcontrol_itab
WHERE kunnr = g_vcontrol_itab-kunnr AND budat = g_vcontrol_itab-budat.
loop at g_vcontrol_itab into g_vcontrol_wa.
read table g_vcontrol_itab1 into g_vcontrol_wa1
with table key g_vcontrol_wa-kunnr = kunnr and g_vcontrol_wa-budat = budat.
if sy-subrc = 0.
delete g_vcontrol_itab.
endif.
endloop.
LOOP AT g_vcontrol_itab INTO g_vcontrol_wa.
INSERT into zcust_call_rec values g_vcontrol_wa.
ENDLOOP.
with this iam getting error message like this.
<b>g_vcontrol_wa-budat is not expected.</b> -
Inserting records into Table with check table logic in place
I want to insert records into a table, and have the check table to not allow invalid entries. Is there a function out there that will allow this? I am currently using the insert statement and it is working except that it is not giving an error when the value does not exist in the check table for the particular fields.
INSERT INTO ZSD_XREF VALUES WA_XREF.
That is the basic statement I'm using ZSD_XREF has several fields one being the material number field tied to the check table which happens to be MAKT file. The insert statement is not validating the material numbers using the check table, or at least it is not giving an error. Any ideas?Paul,
Unfortunately, open SQL statements such as INSERT, UPDATE do not go through the check table logic as they directly hit the database layer. Check table checks are performed only if you go through application layer that is when you enter the same data through a screen.
You have to do the checks yourself.
Happy checking!!!
Srinivas -
Error While Inserting Data into table using OAF
Hi Experts,
I am learning OAF; i am trying into insert the data into table using OAF. I followed the below procedure.
My table(OLF_TEST_TBL) Columns:
EmpID (Number), Ename(VARCHAR2 100), Sal Number, and who columns.
1. created Application Module (AM).
package: oracle.apps.mfg.simplepg.server
name: oaf_test_tbl_am
2. created simple page
name:EmployeePG
package:oracle.apps.mfg.simplepg.webui
3. Assigned the Application Module to Page
4. Created Entity Object(EO)
name:oaf_test_tbl_eo
package:oracle.apps.mfg.simplepg.schema.server
schema:apps
table:OLF_TEST_TBL
note:
1. EMPID column is selected as primary key
2. selected create method, remove method and validation method.
3.checked generate default view object
VO:
name:olf_test_tbl_vo
note: Entity Object was assigned to VO
Coming To page:
page main region:EmployeeMainRN
1.under main region i created one more region using wizard
selected AM and VO, region style-default single column
2. under main region i created one more region
region style- pagebuttonbar, ID:pagebutoonsRN
3. under pagebuttonRN, created two submit buttons(ID:SUBMIT, ID:CANCEL).
In AM java page:
created a method to insert row and for commit.
Insert Method:
public void insertrow(){
OAViewObject vo=(OAViewObject)getoaf_test_tbl_vo1();
if(!vo.isPreparedForExecution()){
vo.executeQuery();
Row row=vo.createRow();
vo.insertRow(row);
row.setNewRowState(Row.STATUS_INITIALIZED);
Commit Method:
public void savaDataTooaftesttable(){
getDBTransaction().commit();
In EmployeeMainRN, created a controller.
In this controller process request method, 'insertrow' method was called.
import oracle.apps.fnd.framework.OAApplicationModule;
public void processRequest(OAPageContext pageContext, OAWebBean webBean)
super.processRequest(pageContext, webBean);
if (!pageContext.isFormSubmission())
OAApplicationModule am = pageContext.getApplicationModule(webBean);
am.invokeMethod("insertrow");
To commit the transaction when SUBMIT button pressed, commit method was called in process form request method.
import oracle.apps.fnd.framework.OAViewObject;
public void processformRequest(OAPageContext pageContext, OAWebBean webBean)
super.processFormRequest(pageContext, webBean);
OAApplicationModule am = pageContext.getApplicationModule(webBean);
if (pageContext.getParameter("SUBMIT") != null)
am.invokemethod("savaDataTooaftesttable");
Error After clicking the submit button_
I ran the page, page was opened successfully. Once i enter data and click submit button, it's giving the following error.
The requested page contains stale data. This error could have been caused through the use of the browser's navigation buttons (the browser Back button, for example). If the browser's navigation buttons were not used, this error could have been caused by coding mistakes in application code. Please check Supporting the Browser Back Button developer guide - View Object Primary Key Comparison section to review the primary causes of this error and correct the coding mistakes.
Cause:
The view object oaf_test_tbl_am.oaf_test_tbl_vo1700_oaf_test_tbl_vo1_practice_test_prc1_oracle_apps_mfg_simplepg_server_oaf_test_tbl_am.oaf_test_tbl_vo1 contained no record. The displayed records may have been deleted, or the current record for the view object may not have been properly initialized.
To proceed, please select the Home link at the top of the application page to return to the main menu. Then, access this page again using the application's navigation controls (menu, links, and so on) instead of using the browser's navigation controls like Back and Forward.
Experts, Kindly help me why i am getting this error.
Awating your replies.
Thanks in advance.If you dont want to create message. You can throw exception like below as well
throw new OAException("Emp Id is "+empId+" and employee name is "+empName, OAException.CONFIRMATION);Thanks
--Anil -
Inserting to a table using same table and master table
[code]
I have a table test_master where I have stored the status of the individual claims ; the status would be changed quarterly basis.
I have another table test_detail which will store status chages on each quarter.The curr_status column will store the status from test_master; and prev_status will be the curr_status for the previous trans_id from test_detail table itself
create table test_master( claim_id number,
status varchar2(10));
insert into test_main VALUES (100, 'L1');
insert into test_main VALUES (101, 'L2'); ---- first quarter data.. it will be purged at the begining of second quarter
insert into test_main VALUES (102, 'L1');
insert into test_main VALUES (103, 'L3');
insert into test_main VALUES (100, 'L2');
insert into test_main VALUES (101, 'L2'); ---- second quarter data.. it will be purged at the begining of third quarter
insert into test_main VALUES (102, 'L1');
insert into test_main VALUES (103, 'L4');
insert into test_main VALUES (100, 'L4');
insert into test_main VALUES (101, 'L5'); ---- third quarter data.. it will be purged at the begining of fourth quarter
insert into test_main VALUES (102, 'L6');
insert into test_main VALUES (103, 'L7');
create table test_detail( trans_id number,
claim_id number,
prev_status varchar(20),
curr_status varchar2(21
prev_status = curr_status of the previous id for same claim_id s
curr_status = status from TEST_MASTER
how to write an insert statement to insert records in TEST_DETAIL to have below expected data?
id claim_id PREV_STATUS CURR_STATUS
1 100 null L1 ---prev_status will be null for the first run
1 101 null L2
1 102 null L1
1 103 null L3
2 100 L1 L2
2 101 L2 L2
2 102 L1 L1
2 103 L3 L4
3 100 L2 L4
3 101 L2 L5
3 102 L1 L6
3 103 L4 L7
[/code]
Thanks
-AnnHi,
Do you really need to store prev_status in test_detail? You can always compute it on the fly, using the analytic LAG function, and you won't have to worry about re-computing it when test_detail is updated.
If test_detail will never be updated, and performance is important, then you may want to store prev_status. Here's one way to do that.
When you're ready to archive the data from test_main, then run this INSERT statement:
INSERT INTO test_detail (trans_id, claim_id, prev_status, curr_status)
SELECT &2, m.claim_id, d.curr_status, m.status
FROM test_main m
LEFT OUTER JOIN test_detail d ON d.claim_id = m.claim_id
AND d.trans_id = &1
Where &1 is the previous trans_id (the highest value already in test_detail), and &2 is the new trans_id (&1 + 1).
The first time you run this, when test_detail is empty, it doesn't matter what value you use for &1; you can use 0.
After you've confirmed that this worked, then you can start putting new data into test_main.
I assume that test_master and test_main are the same table. -
Insert record in table having BLOB datatype
Hi All,
I have a table with BLOB datatype, Pls assist me how to insert a record in this table?
CREATE TABLE document_BLOB_tab (
doc_id_no NUMBER
, doc_name VARCHAR2(200)
, doc_value BLOB);
What are the process to execute DBMS_LOB.fileOpen ?
Rgds
Sarfaraz1- Create a table that has a list of all directory, filenames combination
SQL> create table listpic (directory varchar2(10), filename varchar2(10));
Table created.
2- Insert into that table all your directories and the filenames of the images within each
directory (directory, filename) combination
on my file system, I have
d:\tars\samples1\lilies.jpg
d:\tars\samples1\Sunset.jpg
d:\tars\samples2\Blue.jpg
d:\tars\samples1\Winter.jpg
Here is my insert statment
SQL> insert into listpic values('Samples1', 'lilies.jpg');
1 row created.
SQL> insert into listpic values('Samples1', 'Sunset.jpg');
1 row created.
SQL> insert into listpic values('Samples2', 'Blue.jpg');
1 row created.
SQL> insert into listpic values('Samples2', 'Winter.jpg');
1 row created.
SQL> commit;
Commit complete.
SQL> select * from listpic;
DIRECTORY FILENAME
Samples1 lilies.jpg
Samples1 Sunset.jpg
Samples2 Blue.jpg
Samples2 Winter.jpg
3- Create the table where you are going to store your pictures
SQL> create table pictures (id number(5), image blob);
Table created.
4- Create a directory pointing to the common parent Directory
SQL> create or replace directory IMAGES as 'd:\tars';
Directory created.
5- Create the following procedure to insert the image
SQL> set serveroutput on
SQL> create or replace procedure insert_image as
2 f_lob bfile;
3 b_lob blob;
4 i number := 1;
5 cursor image_cur is select directory, filename from listpic;
6 pic_rec image_cur%ROWTYPE;
7 begin
8
9 OPEN image_cur;
10 Loop
11 fetch image_cur into pic_rec;
12 EXIT WHEN image_cur%NOTFOUND;
13 insert into pictures values ( i, empty_blob() )
14 return image into b_lob;
15
16 f_lob := bfilename( 'IMAGES','\'||pic_rec.DIRECTORY||'\'||pic_rec.FILENAME);
17 dbms_lob.fileopen(f_lob, dbms_lob.file_readonly);
18 dbms_lob.loadfromfile( b_lob, f_lob, dbms_lob.getlength(f_lob) );
19 dbms_lob.fileclose(f_lob);
20 dbms_output.put_line (pic_rec.directory ||'\'||pic_rec.filename);
21 commit;
22 i := i+1;
23 END LOOP;
24 end;
25 /
Procedure created.
6- execute the procedure
SQL> exec insert_image;
Samples1\lilies.jpg
Samples1\Sunset.jpg
Samples2\Blue.jpg
Samples2\Winter.jpg
PL/SQL procedure successfully completed.
SQL> select count(*) from pictures;
COUNT(*)
4
SQL> select length(image) from pictures;
LENGTH(IMAGE)
83794
71189
28521
105542
Image has been uploaded to the dataabase.
Maybe you are looking for
-
How to match a series of midi events to the tempo?
hello there, i've got a series of midi events that i'd like to adjust to the tempo -there are only quarter notes. i thought to use flex time but it seems to be working with audio tracks only. any idea? as well, i'd like to fix all notes to a same len
-
My MBP 15' have absolutely no sound and when i try to change volume the bar is just grey and locked when i try to use the build in speakers. Also red light is coming out of the jack hole and the sound on headphones is garbage and unlistenable. I rest
-
Interest for a lessons learned information page?
Hi all. I just want to know if there is any interest in a lessons learned information in the wiki pages. Idea is to enlighten security minded persons of some of the security holes there are in the system. However, there is a backside to it and that i
-
Field mismatched from Source system
Hi , In BI Data target,for ZZAFLD000012 field , data is not coming from CRM source system , when checking in CRM side ,it doesn't contain any data & mapped in the Standard Data source 0CRM_SRV_PROCESS_H of BI . In CRM . In CRM source sy
-
In windows I am having a problem when it ask what program do you want to open this file. I do not have a Firefox icon to click from the the list. Am I suppose to have an icon for Firefox Icon, or what do I do? I use Windows 7 an use Google for my sea