Problem inserting record using INSERT INTO

I'm an amateur web by using the features of ColdFusion Builder to access an Access database information. I know very little about the ColdFusion syntax, but I use Dreamweaver CS3 to generate most of the code. I'm working on a page of the insert file to create a database of the user with the login information. I don't know what the problem is, but I get a syntax error referencing this particular part of the code:

Syntax error in INSERT INTO statement.
The error occurred in C:\ColdFusion9\wwwroot\Everett\register.cfm: line 22

Here is the entire page with line 22 (referenced in the error message) in red. Any ideas?

< cfset GetFileFromPath = CurrentPage (GetBaseTemplatePath ()) >
< cfif IsDefined "(FORM. MM_InsertRecord") AND the FORM. MM_InsertRecord EQ 'register' >
< cfquery datasource = "everettweb" >
INSERT users ([name], [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 / / IN" "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 hand. CSS"rel ="stylesheet"type =" text/css"/ >
< meta http-equiv = "Content-Type" content = text/html"; charset = utf-8 "/ >"
<!-InstanceBeginEditable name = "doctitle"-->
Department of music < title > Everett, Everett, Massachusetts < /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 is d.MM_p.length, a = MM_preloadImages.arguments; for (i = 0; i <.) 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 = offline. MM_sr; for (i = 0; a & & I <.) 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]) & & copyrights) 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 hand. 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" >
< b >
< td colspan = "3" > < img src = "top_border.jpg" width = "960" height = "20" align = "top" / > < table > "
< /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 > < table >
< /tr >
< b >
"< td height ="35"width ="301"> < a href ="index.php"> < img src =" e_oval_bottom.jpg"height ="35"width ="234"border ="0"/ > < /a > < a href =" # "MM_swapImgRestore" onmouseover = "MM_swapImage (" self "", 'menu_home_over.jpg', 1) "> < img src =" menu_home.jpg "width ="67"height ="35"name ="home"border ="0"id ="home"/ > < /a > < table >
< td width = "251" > < ul id = "MenuBar1" class = "MenuBarHorizontal" >
"< li > < a class ="MenuBarItemSubmenu"href =" # "MM_swapImgRestore" onmouseover = "MM_swapImage ('subject',", '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 = "#" > story < /a > < /li >
< li > < a href = "#" > media < /a > < /li >
< /ul >
< /li >
"< li > < a class ="MenuBarHorizontal"href =" # "MM_swapImgRestore" onmouseover = "MM_swapImage (" sets ",", 'menu_ensembles_over.jpg', 1) "> < img src =" menu_ensembles.jpg"width ="98"height ="35"name = 'sets' border ="0"id ="sets"/ > < / has >"
< ul >
< li > < a href = "#" > Strip < /a > < /li >
< li > < a href = "#" > Chorus < /a > < /li >
< li > < a href = "#" > string < /a > < /li >
< /ul >
< /li >
"< li > < a class ="MenuBarItemSubmenu"href =" # "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' / > < / has >"
< 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 = "#" > School Lafayette < /a > < /li >
< li > < a href = "#" > Parlin school < /a > < /li >
< li > < a href = "#" > school Webster < /a > < /li >
< li > < a href = "#" > Whittier school < /a > < /li >
< /ul >
< /li >
< /ul >
< table >
"" "" < td width = "408" > < a href = "#" MM_swapImgRestore "onmouseover =" MM_swapImage ('events', ", 'menu_events_over.jpg', 1)" > < img src = "menu_events.jpg" width = height = "74" "35" name = 'events' border = "0" id = "events" / > < /a > < a href = "#" MM_swapImgRestore"onmouseover =" MM_swapImage ("Faculty",", 'menu_faculty_over.jpg', 1)" > < img src = "menu_faculty.jpg" width = height "79" = "35" name = "Faculty" border = "0" id = "Faculty" / > < /a > < a href = "#" 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 = "#" 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 = "#" 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"/ > < table >"
< /tr >
< height '10' = tr >
< td colspan = "3" > < img src = "menu_bottom_spacer.jpg" height = "10" width = "960" / > < table > "
< /tr >
< /table >
< table width = "960" cellpadding = "0" cellspacing = "0" align = "center" >
< height tr = "50" >
< td width = "30" background = "left_border.jpg" > < img src = "clear.gif" width = "30" height = "50" / > < table > "
< td width = "900" bgcolor = "#FFFFFF" >
< table width = "900" cellpadding = "0" cellspacing = "0" >
< b >
< td width = "900" height = "350" valign = "top" > <!-InstanceBeginEditable name = "PageBody"->
< form action = "" < cfoutput > #CurrentPage # < / cfoutput > "method ="POST"name ="registration"preloader =" "id ="registration">"
< table width = "100%" >
< b >
< td colspan = "2" class = "title 1" > fill out the information below to register for this site: < table >
< /tr >
< b >
< td colspan = "2" > < img src = "clear.gif" height = "15" / > < table > "
< /tr >
< b >
< td width = "50%" class = "form" align = "right" > first name: < table >
< td width = "50%" > < span id = "sprytextfield1" >
< input type = "text" name = "FirstName" required = "Yes" id = "first name" width = "150" typeahead = "" showautosuggestloadingicon = "true" / >
< span class = "textfieldRequiredMsg" > a value is required. </span > < / span > < table >
< /tr >
< b >
< class td 'form' align = 'right' = > name: < table >
< td > < span id = "sprytextfield2" >
< input type = "text" name = "last_name" required = "Yes" id = "last_name" width = "150" typeahead = "" showautosuggestloadingicon = "true" / >
< span class = "textfieldRequiredMsg" > a value is required. </span > < / span > < table >
< /tr >
< b >
< class td 'form' align = 'right' = > E-mail address: < table >
< td > < span id = "sprytextfield3" >
< input type = "text" name = "email" validate = "email" required = "Yes" id = "email" width = "150" typeahead = "" showautosuggestloadingicon = "true" / >
< span class = "textfieldRequiredMsg" > a value is required. </span > < span class = "textfieldInvalidFormatMsg" > Invalid format. </span > < / span > < table >
< /tr >
< b >
< class td = 'form' align = 'right' > confirm E-mail address: < table >
< td > < span id = "sprytextfield4" > < span id = "ConfirmWidget" >
< input type = "text" name = "email_confirm" validate = "email" required = "Yes" id = "email_confirm" width = "150" typeahead = "" showautosuggestloadingicon = "true" / >
< span class = "confirmInvalidMsg" > values do not match < / span > < / span > < / span > < table >
< /tr >
< b >
< class td = 'form' align = "right" > password: < table >
< td > < span id = "sprytextfield5" >
< input type = "password" name = "password" required = "Yes" id = "password" width = "150" / >
< span class = "textfieldRequiredMsg" > a value is required. </span > < / span > < table >
< /tr >
< b >
< class td = 'form' align = 'right' > confirm password: < table >
< td > < span id = "sprytextfield6" > < span id = "ConfirmWidget" >
< input type = "password" name = 'password_confirm"required ="Yes"id = 'password_confirm' width ="150"/ >
< span class = "confirmInvalidMsg" > values do not match < / span > < / span > < / span > < table >
< /tr >
< b >
< td > < table >
< td > < input name = "submit" type = "submit" id = "submit" value = "Save" / > < table >
< /tr >
< /table >

< input type = "hidden" name = "MM_InsertRecord" value = "Save" / >
< / make >
< 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--> < table >
< /tr >
< /table >
< table >
< td width = "30" background = "right_border.jpg" > < img src = "clear.gif" width = "30" height = "50" / > < table > "
< /tr >
< b >
< td colspan = "3" background = "footer.jpg' class = 'footer' height = '80'" / > this site best displayed using: < br / > < a href = "http://www.firefox.com" > < img src = "firefox_logo.gif" width = "110" height = "40" border = "0" / > < /a > < table > "
< /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)

This oh-so-vague error is "Password" is a reserved word with your database driver.  Is it escape by putting brackets around it too, either rename the column permanently. It is best to avoid using reserved words where possible. To rename the column is the best option.  In addition, I try and avoid using invalid characters such as spaces in column names i.e. "first name". It is technically possible, but it requires special treatment everywhere that adds unnecessary complexity.

I don't know what the problem is, but I get a syntax error referencing this particular part of the code:

Do not take as gospel error line numbers. Sometimes, they simply indicate that the error is in the vincinty of this line.

I use Dreamweaver CS3 to generate most of the code

Unforutnately, DW assistants generate some really terrible and verbose code.  To give you an idea, here's what the query should look like, without all the nonsense of the wizard.

 

 

 

 

 


   

    INSERT INTO Users ([First Name], [Last Name], [Email Address], [Password])

    VALUES (

     

     ,

     ,

     ,

    )

 


  

CF is fairly easy to learn. You can start browsing the CF documentation and some tutorials to familiarize yourself with the language. As you work with a database, I also recommend a SQL tutorial.

Tags: ColdFusion

Similar Questions

  • Problem to INSERT INTO using the stored procedure in 10g

    I use a 10g R2 database.

    I created two tables as follows:
    SQL > create table t1 (c1 varchar2 (1), number (1) c2, c3 number (1);)
    SQL > create table t2 (deptid varchar2 (4), empid varchar (4), varchar2 (1) c1, c2 number (1) c3 number (1);)

    insert into t1 values ('A', 3, 5);
    insert into t1 values ('B', 5, 5);
    insert into t1 values ('C', 5, 5);

    I want to create a stored procedure to insert data into table t1 t2 and certain parameters of the procedure.
    Is this possible?
    As an example:
    SQL > execute test (1,2)

    This procedure will be insert these two parameters in table t2 AND select rows in table t1 and insert into table t2 at the same time.
    How can I write the procedure?
    Tip:
    SQL > create or replace procedure
    (v_deptid, v_empid number)
    is
    BEGIN
    Insert into t2 (deptid, empid, c1, c2, c3)
    ... Select c1, c2, c3 from t1;
    end;

    My question is: How can I insert the v_deptid and v_empid parameters at the same time?

    Try

    SQL > create or replace procedure
    (v_deptid, v_empid number)
    is
    BEGIN
    Insert into t2 (deptid, empid, c1, c2, c3)
    Select v_deptid, v_empid, c1, c2, c3 to t1;
    end;

  • Impossible to insert a 1 d table in a 2D array using "insert into array.

    Hi all

    I have a very simple problem.

    I try to insert a table 1 d as a column in a table 2D using 'insert into array"as stated in image1.

    When I try to connect the table 1 d in the "new element/sub-table" terminal I get the error indicated in image2.

    According to the help files, I should be able to wire a table of size n-1 this as the 'new item/sub-table"terminal. In other words

    I should be able to connect a table 1 d here.

    Can someone tell me what I am doing wrong?

    Thanks for your help,

    Apparently I had converted the table to float in a 'worksheet chain' and I needed to convert it into an array before sending it to 'insert into array.

    Discover image3 for more details.

  • records by inserting into one another table

    Hi Masters

    I have to insert records from table to table b, which do not exist in table b. Please, help me in this record.

    create table test1 (eno number (2), ename varchar2 (10));

    Insert into test1 values(1,'abc');
    Insert into test1 values(2,'xyz');
    Insert into test1 values(3,'pqr');
    Insert into test1 values(4,'vara');

    create table test2 (eno number (2), ename varchar2 (10));

    Insert into test2 values(2,'xyz');
    Insert into test2 values(4,'vara');

    I tried like this...

    SQL > get the ap;
    1. INSERT ALL
    2. WHEN r_num = 1
    3 THEN IN VALUES test2 (eno, ename)
    4 OTHER INTO test2 VALUES (null, null)
    5. SELECT eno, ename
    6, ROW_NUMBER () OVER (PARTITION BY eno, ename)
    7 ORDER BY eNAME - or else
    8                             )  AS r_num
    9 * FROM test1
    SQL > /.

    4 lines were created.

    SQL > select * from test2;

    ENO ENAME
    ----- ----------
    2 xyz
    4 vara
    1 abc
    2 xyz
    3 pqr
    4 vara

    6 selected lines.

    the result above is not correct... Please advice.

    Concerning

    Evelyne

    Use MERGE:

    SQL > select * from test1;

    ENO ENAME
    ---------- ----------
    1 abc
    2 xyz
    3 pqr
    4 vara

    SQL > select * from test2;

    ENO ENAME
    ---------- ----------
    2 xyz
    4 vara

    SQL > fusion
    2 in test2
    3 using test1
    4 you (test1.eno = test2.eno and test1.ename = test2.ename)
    5 when not matched
    6. then insert
    7 values(test1.eno,test1.ename)
    8.

    2 lines merged.

    SQL > select * from test2;

    ENO ENAME
    ---------- ----------
    2 xyz
    4 vara
    3 pqr
    1 abc

    SQL >

    SY.

  • Use the trigger and seq to insert into 2 tables

    I created a sequence.

    I have 2 tables

    I want a trigger that when I insert in the 1 table inserts the sequence number nextval, that is no problem, but also is there a way so that once that happens it also inserts this same value of sequence in another table.

    So the end result is a new record in the table has the seq value and a new record in table b with the same value of seq (and the rest of the fields blank)

    Thanks for any help

    Could do:

    SQL > create the sequence myseq;

    Order of creation.

    SQL > drop table t2 is serving;

    Deleted table.

    SQL > drop table t1 is serving;

    Deleted table.

    SQL > create table t1 (collar number);

    Table created.

    SQL > create table t2 (collar number);

    Table created.

    SQL > create or replace trigger mytrig

    2 before the Insert on t1

    3 for each line

    4 start

    case 5: new.col is null

    6. can

    7: new.col: = myseq.nextval;

    8 insert into t2 (col)

    9. Select myseq.currval

    10 double;

    11 end if;

    12 end;

    13.

    Trigger created.

    SQL > insert into values (null), t1 (col);

    1 line of creation.

    SQL > select * from t1;

    COL

    ----------

    1

    1 selected line.

    SQL > select * from t2;

    COL

    ----------

    1

    1 selected line.

  • Issue when inserting into a table using sequence in Oracle 11 g Rel 2

    Hi all

    I am facing problem when I insert sequence values in my table.
    When inserting, my sequence does not begin with the beginning with the value.
    Example Script

    CREATE SEQUENCE xyz_seq
    START WITH 1
    INCREMENT BY 1
    NOMAXVALUE
    MINVALUE 1
    NOCYCLE
    NOCACHE
    ALL;

    create table abc (a number not null);

    insert into abc (xyz_seq.nextval) values;

    Select *.
    ABC;

    xyz_seq sequence of fall;

    drop table abc;

    Output

    Order of creation.
    Table created.
    1 line of creation.

    ONE
    ----------
    2
    1 selected line.
    Sequence has fallen.
    Deleted table.

    I can't understand why this is inserting value 2, when my sequence should start at 1.


    To overcome that road, I implemented a different logic.
    Example of

    CREATE SEQUENCE xyz_seq
    START WITH 1
    INCREMENT BY 1
    NOMAXVALUE
    MINVALUE 1
    NOCYCLE
    NOCACHE
    ALL;

    create table abc (a number not null);
    declare
    x number (1): = xyz_seq.nextval;
    Start


    insert into abc (x) values.
    end;
    Select *.
    ABC;

    xyz_seq sequence of fall;

    drop table abc;

    Output

    Order of creation.
    Table created.
    PL/SQL procedure successfully completed.

    ONE
    ----------
    1
    1 selected line.
    Sequence has fallen.
    Deleted table.

    However, my question remains why referring to the sequence.nextval in my insert does not return me the beginning with the value.

    Kind regards
    Rishi

    That's what says the doc ;

     If you attempt to insert a sequence value into a table that uses deferred segment creation, the first value that the sequence returns will be skipped.
    

    It ignores the value 1 and returns 2.

  • Insert into DB using SQLservice: can't take the text with single quotes:

    I use Execute sql JDBC service statement.

    I'll explain with simple code:

    insert into mytable (id, desc) values (1, 'this is the document of the customer');

    This works perfectly.

    But if I have apostrophes in the desc-

    insert into mytable (id, desc) values (1, 'this is the document the customer' );

    It is throwing error at a standstill operation errors.

    I know that in Oracle, to escape the single quotes that write us

    insert into mytable (id, desc) values (1, "it is of customer" s document ");

    But, we can not control here in Adobe as the desc is from field on a form when the user enters it.

    I'm guessing that it might be a known issue & can someone tell me the solution.

    Thank you

    KC

    Use a parameter query to avoid this problem.

    insert into mytable (id, desc) values (?,?);

    The two parameters (? brands) can be replaced by actual values using XPATH Expression.

    If you do this, you query runs without raising any errors.

    Nith

  • Select the statement to insert into a table by using a loop

    Hello
    create table uploadtab(
    itema varchar2(3),
    xtype varchar2(1),
    salesa number,
    margina number,
    salesb number,
    marginb number,
    salesc number,
    marginc number);
    
    insert into uploadtab
      (itema, xtype, salesa, margina, salesb, marginb, salesc, marginc)
    values
      ('abc', 'a', 100, .40, 300, .10, 450, .25);
    
    create table testinsert(itema varchar2(3),
    xtype varchar2(1),
    sales number,
    margin number);
    what I want to do is create 3 records based on this one in a loop
    so here's my desired for testinsert output
    abc  a 100  .40
    abc  a 300  .10
    abc  a 450  .25
    I don't want to use 3 insert tables if possible

    any help would be greatly appreciated
    Thanks in advance

    Published by: DM on July 7, 2010 14:22

    This gives a shot:

    INSERT INTO testinsert
    ( itema
    , xtype
    , sales
    , margin
    )
    SELECT  itema
    ,       xtype
    ,       DECODE
            ( RN
            , 1,salesa
            , 2,salesb
            , 3,salesc
            )
    ,       DECODE
            ( RN
            , 1,margina
            , 2,marginb
            , 3,marginc
            )
    FROM            uploadtab
    CROSS JOIN      (
                            SELECT ROWNUM RN
                            FROM   dual
                            CONNECT BY LEVEL <= 3
                    )
    ;
    
  • insert into multiple tables by using select in stored procedure

    I use oracle 10g R2. I want to insert records in two tables by using a select query (insert into tablename select...) in a stored procedure. How can I insert records into a table two at the same time using a select statement?

    My second question is also related to the first... can I use mechanism clustering here because the two tables are based on the same structure and data? One contains data from 24 hours and there are records of 10 days.

    Thank you.

    If you find the answer of Aman as useful/correct, please mark her answer respectively and close the debate. I think his answer is correct as always / a lot of time.

    Concerning
    Girish Sharma

  • "missing the SELECT keyword" error during an insert into the temporary table using the blob value

    I'm trying to insert into an oracle temp table using select that retrieves data from a blob field but I get the error: "lack the SELECT keyword.

    How we store temporary in oracle result when we make this type of operation (extraction of data in fields and try to load them into a separate table on the fly.?)

    with cte as)

    Select user_id, utl_raw.cast_to_varchar2 (dbms_lob.substr (PREFERENCES)) as USER my_blob

    )

    create table new_table as

    SELECT user_id,EXTRACTvalue(xmltype(e.my_blob),'/preferences/locale') regional settings

    E ETC

    ----------------------------------------------------------------------------------

    BLOB data - value - which is

    <? XML version = "1.0" encoding = "ISO-8859-1" ?>

    - < Preferences >

    < time zone > America/New_York < / > zone

    < displayscheduleinusertimezone > Y < / displayscheduleinusertimezone >

    < local > Spanish < /locale >

    < DateFormat > JJ/mm/aaaa < / DateFormat >

    < timeFormat > hh: mm aaa < / timeFormat >

    < longformat > Long_01 < / longformat >

    < doubleformat > Double_01 < / doubleformat >

    < percentformat > Percentage_01 < / percentformat >

    < currencyformat > Currency_01 < / currencyformat >

    < / Preferences >

    A WITH clause that must immediately precede the SELECT keyword:

    SQL > create table t:

    2 with the o as (select double dummy)

    3 select * West longitude;

    Table created.

  • insert into the table based on the difference in line (or using less)

    Hello

    Oracle Version: 11g

    Operating system: Solaris 10.

    I was wondering if it is possible to insert data in a table based on the operator 'less' Please?

    We have a very large table in a database, we moved to a different database. The table is cleared by a line for a certain range of dates, and we wondered if it is possible to insert this line of data in the remote database using the difference of rank between the two tables.

    Here's the query that we are running:

    SELECT ID , TO_CHAR (creation_datetime, 'yyyy-mm-dd')
    from TABB10 
    where TO_CHAR (creation_datetime, 'yyyy-mm-dd')='2014-03-18' 
    minus 
    SELECT ID , TO_CHAR (creation_datetime, 'yyyy-mm-dd')
    from TABB10@TABB_LINK.APDB00 
    where TO_CHAR (creation_datetime, 'yyyy-mm-dd')='2014-03-18'
    

    TO_CHAR (CR ID

    ---------------------- ----------

    2.4111E + 17-18 / 03 / 2014

    Any ideas please?

    Thank you

    If I don't get me wrong, you can insert as below

    INSERT INTO REMOTE_TABLE@DBLINK

    SELECT ID, TO_CHAR (creation_datetime, "yyyy-mm-dd")

    of TABB10

    where TO_CHAR (creation_datetime, 'yyyy-mm-dd') ='' 2014-03-18

    less

    SELECT ID, TO_CHAR (creation_datetime, "yyyy-mm-dd")

    of TABB10@TABB_LINK. APDB00

    where TO_CHAR (creation_datetime, 'yyyy-mm-dd') ='' 2014-03-18

    Concerning

  • Problem inserting values into a table

    Hi all

    I'm newbe and I'm stack.
    I have a human tasks (model begun), which contains 4 input fields (all channels).
    I have a complex data type called Test, which is defined as 2 channel fileds (Description and result) and a registered number (test).
    I have a Test table, insiemiDiTest.
    What I want to do is to create 2 test object in the input fields and insert in the insiemiDiTest table, to then be able to use the loop to insert into the DB.
    Assume that the user insert the following information in the filed entry:
    INPUT1 descrTest1
    ResultTest1-INPUT2
    INPUT3 descrTest2
    INPUT4 resultTest2
    I want to play in the process of the insiemiDiTest variable of length 2 and the following content:
    insiemiDiTest [1] .testNumber = 1
    insiemiDiTest [1] .description = descrTest1
    insiemiDiTest [1] property = resultTest1
    insiemiDiTest [2] .testNumber = 2
    insiemiDiTest [2] .description = descrTest2
    insiemiDiTest [2] property = resultTest2

    If I use data binding and I have a link
    INPUT1 with .description insiemiDiTest [1]
    INPUT2 with property insiemiDiTest [1]
    Number('1') with .testNumber insiemiDiTest [1]
    I get an error saying that the insiemiDiTest [1] .description is empty and cannot be copied.

    Unfortunaly I can't directly use the table in the task of the user, because later I have to use the conversation when the calling process and we found I have limitation.
    I can get an indication on how to do it.
    I'm approccing in the right way or am I completely wrong?
    Thanks in advance and Merry Christmas.

    Because your input is coming from a few strings and not a table, you can just add a Script activity to your process and to define table of your target XSD using XML.

    To do this, you must add a Script to the activity-> click on "Data Associations"-> drag the icon above your target expression builder object on the right side (not the table but the table parent)-> open the XPath expression box in the Middle-> click 'XPath Exp' in the drop-down list at the top.

    I don't know what your XSD, but in the text below, I tried to show you the XML you need for this XPath expression using the values you provided.

    oraext:parseXML(concat('
    
      
        ','1','
        ',bpmn:getDataObject('descTest1'),'
        ',bpmn:getDataObject('resultTest1'),'
      
    
      
        ','2','
        ',bpmn:getDataObject('descTest2'),'
        ',bpmn:getDataObject('resultTest2'),'
      
    
    '))
    

    When I 'bpmn:getDataObject('...')', you should rather to insert your data object variables four your process chain.

    Hope this helps,
    Dan

  • Record is not inserted into the transparent Table Forms 10g

    Hi all

    I have the built in 10g (10.1.2.0.2) form.

    Basically, the form has 2 blocks.
    1 block with a single element, where we enter a value and press on enter (this place you block2 and run the query).
    Block 2 (tabular) will get the records. This block2 have now 3 columns (caseid, userid, date).

    Now when I insert a new record, I just need to get the caseid only. And username and date must be filled in automatically.
    I can fill fields username and the DATE.
    And when I enter a value element of the block 2 caseid and then Control + S(to insert the record and Save the transaction),.
    I get the message saying FRM-40400: transactions: 1 applied and saved records.
    But when I ask again for the same thing, I do not have is the record inserted into the table.
    Why is this happening?

    Help please...

    Drop the trigger for INSERTION WE (do not comment code or write NULL) and move your code to INSERT before trying.

    -Clément

  • Insert into a table using UNIX

    I have the Summary.txt file

    constants looks like this

    ./log_CS-185.lst:error detected, rollbacking
    ./log_CS-13603.lst:error detected, rollbacking
    ./log_CS-1002.lst:error detected, rollbacking

    now, I have to scan this file for (CS-185, CS-13603, CS-1002)

    and insert these raising into a table... How can I do this using unix script?...

    I have to scan this file for (CS-185, CS-13603, CS-1002)

    and insert these raising into a table... How can I do this using unix script?...

    Example:

    $ cat read_Sum.sh
    cat Summary.txt | while read LINE
    do
            VAR=`echo $LINE | awk -F_ '{print $2}' | awk -F. '{print $1}'`
            echo $VAR
            sqlplus -s test/test << EOF
            insert into summary values('$VAR');
            exit
    EOF
    done
    $ ./read_Sum.sh
    CS-185
    
    1 row created.
    
    CS-13603
    
    1 row created.
    
    CS-1002
    
    1 row created.
    
    $ sqlplus test/test
    
    SQL*Plus: Release 10.2.0.3.0 - Production on Thu May 19 13:32:40 2011
    
    Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.
    
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
    With the Partitioning, OLAP and Data Mining options
    
    SQL> select * from summary;
    
    CODE
    --------------------------------------------------
    CS-185
    CS-13603
    CS-1002
    
    SQL>
    
  • SQL error: ORA-00947 while using INSERT INTO

    Hello

    I work with an INSERT INTO statement that returns ORA-00947.

    INSERT INTO prod (pId, a, b, c and d, e, f, g, h, i)
    VALUES (SEQ_PROD. NEXTVAL, 1,.
    (Select to_char (v.pdate, 'YYYY')
    to_char(v.pdate,'MM')
    d.prod
    , ROUND (sum (v.f) / 10)
    COUNT (*)
    Of...
    Group of to_char(v.pdate,'YYYY'), to_char(v.pdate,'MM'), d.prod
    )
    (0,0,0);

    10 fields are mapped in 10 fields. The data types match. The sub-select statement works very well.

    Any ideas?

    Sedso
    INSERT INTO prod (pId,a,b,c,d,e,f ,g,h,i)
    select  SEQ_PROD.NEXTVAL,1 a,b,c,d,e,f ,g,h,i FROM
    (select
       to_char(v.pdate,'YYYY') b, to_char(v.pdate,'MM') b, d.prod d, ROUND(sum(v.f)/10) e, COUNT(*) f,0 g,0 h,0 i
     from ...
    group by to_char(v.pdate,'YYYY'), to_char(v.pdate,'MM'), d.prod)
    

    Try this please

Maybe you are looking for

  • Restoration of Apple TV cable... Help

    Restoration of Apple TV I ordered a USB - cable C... when he came an end DID in Apple TV, but the other end was NOT a normal USB connector that would fit in my MacBook Pro... He had a connector like what is happening in my iPhone... Help?

  • After 10.11.5 Update: nothing works: start, the recovery, the new facility,...

    Can someone help me please? On one of our macbook pro: end of 2011 in stock... hard drive, memory stock, after the 10.11.5 update nothing works anymore: -Start: sometimes goes to 70%, 80% of the progress then a few lines appear and the screen goes bl

  • To install Vista on Satellite M60

    Is that what anyone has experienced hardware problems during the installation of Vista on the laptop above. I have already increased the RAM to 2 GB, which is the maximum. I'm sitting looking at a copy of Vista and do not know to install on my laptop

  • HP Pavilion g7-1365dx: wireless keyboard does not work.

    I have a combination and connected mouse microsoft wireless keyboard to my laptop.  The mouse recently 'died' and replace the batteries with new Energizer batteries did not help.  I bought a new Logitech mouse and installed the new USB connector and

  • Received scam call from someone who claims to be from Microsoft, was my system compromised?

    Last week my father received a phone call from someone claiming to be from Microsoft. They asked him to press CTRL and I think that the flag at the same time icon. Now, this week, his computer does not work correctly... He said is to show Arab or he