Concatenation of strings to form an INSERT INTO statement

I am trying to build an insert statement by concatenating strings. Basically, that's what I do:
< cfset string1 = "INSERT INTO #tablename # (" > ").
< cfset string1 = string1 & #colname # >
< cfset string1 = string1 & ")" > "
< cfset string2 = "VALUES ('" > ").
< cfset string2 = string1 & #coldata # >
< cfset string2 = string1 & "')" > "

< cfquery = "insert" datasource name = "db" >
# String1 string2 # #.
< / cfquery >


-----------------------------------------
Also, if I change the < cfquery > tags to < cfoutput > I get a valid INSERT statement:
INSERT INTO Habitat (AREA, ARTID, BIOTOP) VALUES (43, 37, ' text')

But when I have the tag < cfquery > I get this error:
Syntax error (missing operator) in query expression "' text"'.

I tried to change the (' #coldata # ') to ("#coldata") and also tried ("#coldata #") and ("' #coldata # '"), but I get errors all the time...

So. How can I do this?

I'm not asking why you do this :)

but you will need to use preserveSingleQuotes(). probably right around string2, but may not be wrong to just wrap the whole.


#preserveSingleQuotes (string1 & string2) #.

Tags: ColdFusion

Similar Questions

  • Comment of "Syntax error in INSERT INTO statement." validation error.

    I had this working perfectly on MySQL. Then I was told that I had to do with a mdb database in Access, now the errors pop up like crazy. I fixed all of them except this one, I get a "syntax error in INSERT INTO statement." When I try to post a comment on a post in my mini-blog site.

    The thing is, I use almost the same code for the comments I make blog themselves. The positions work fine, the comments are not.

    He said that the error is on my page addcomment_process as 119. It is the following (line 119 is underlined, bold line is also bolded in the error message):

    < name cfquery = "input_comments."

    DataSource = "" #DSN # ""

    username = "" #DSNUSER # ""

    password = "#DSNPASS #" >

    INSERT INTO (comments)

    speaker,

    Comment,

    DateTime,

    post_id

    )

    VALUES)

    "#form.commenter #"

    "#form.comment #"

    "#form.datetime #"

    "#form.post_id #".

    )

    < / cfquery >

    It is all fine data, by simply inserting not, because it says:

    "INSERT INTO comments (speaker, comment, datetime, post_id) VALUES ('Anonymous', 'test commentary.', 25 April 12 22:55 ', ' 2').

    It worked perfectly, when it was a MySQL database, now I keep getting errors present a part of the site now that it is MDB. Anyone know what is happening?

    DateTime is a reserved word in Access.

    --

    Adam

  • Simple Insert Into statement

    I'm new to actually written SQLs to write to databases. So far, I've been pulling data with SQL queries.

    In any case, I have an existing database that I created a new column name Date_Received2
    I am wanting to insert data into this column convert a varchar2 field named Date_Received in Date_Received2.

    I thought it was a simple:
    Insert Into Table(Date_Received2) 
    VALUES (TO_DATE(TO_CHAR(DATE_RECEIVED,'MM/DD/YYYY'), 'MM/DD/YYYY'));
    Please help, I know this is probably very simple. Or if there is a better method to convert a varchar2 in a date field field - that is my main objective here.

    Thank you

    Justin, with all due respect for your contributions for a long time on the forum and the utmost respect of your Ace status, I believe that after having read the post, the OP may actually find an UPDATE here, rather than an INSERT statement.

    «I have an existing database that * I created a new column name Date_Received2 *, I'm wanting to insert data into this column * convert a varchar2 field named Date_Received * Date_Received2.»

    Everything you say about the date conversion is obviously still stands complete and clearly expressed, but I believe (and I could be wrong) that the two columns are in the same table, and then the OP wants to:

     UPDATE  set date_received2 = to_date(date_received,'YYYY-MM-DD').

    What do you think?

  • Forms to insert into my document?

    Where can I find an arrow pour document to insert in my?

    PatriceAntony wrote:

    Where can I find an arrow pour document to insert in my?

    Two possibilities when you chose the shortcut "U".

    In the Panel assessment tool 'screen' you can choose:

    1 - tool 'line in' no options allow you to add an arrow head

    2 - the 'custom shape' tool that offers several drawings of arrows.

  • Syntax error in INSERT INTO statement

    Hi, I have several form fields that are supposed to be inserted in an Access database. Many of the values are dates, I created with drop-down menus that users choose their values from, and then I used the CreateDate/CreateTime function to format correctly to access date/time fields. However... I can't take this error! I checked for if ensure that I do not use any word of the reserve, and I don't think that there are misplaced commas, etc, although I could have missed something. I'm guessing this has something to do with the date fields. I have no specific to their topic formatting in Access. Help, please! Thanks :)

    the star gazer semi wrote
    Yes, everything is
    I don't think so. Play your game of soccer in brackets?

    Although I do not know whence "1899-12-30" on the createTime
    Take a look at the documentation for the access. He explained the signifigance to 1899-12-30
    http://msdn.Microsoft.com/archive/default.asp?url=/archive/en-us/dnaraccess/HTML/msdn_date time.asp

    ' #Trim (form.datestamp) # #Trim (form.timestamp) #.
    Unlike other form values you pass in the timbre of the date and time as a string. Why not use ParseDateTime instead?

  • INSERT INTO statement does not

    I'm trying to insert values from one table into another table using forms. I create the destination table during execution that works very well. But the insert statement doesnot work. It does not error, but no rows are inserted in the destination table, although there are data in the source table. Calling a stored procedure to this effect.

    I wrote the following code in the event When button pressed

    DECLARE
    T_DATE VARCHAR2 (20);
    v_table VARCHAR2 (20);

    BEGIN

    T_DATE: = TO_CHAR (SYSDATE, 'DD') | TO_CHAR (SYSDATE, 'LUN') | TO_CHAR (SYSDATE, 'YYYY');
    v_table: = 't' | T_DATE;         -It's a destination table name, the table is separately created with the same name

    BACKUP_PRODUCTS (v_table);        -Stored procedure

    END;


    According to the code of procedure stored

    PROCEDURE backup_products (p_table VARCHAR2) IS

    BEGIN
    RUN IMMEDIATELY "INSERT" | p_table | "(SELECT product_id, name, price FROM products);
    END;


    I already checked that the stored procedure is executed using some arbitrary return values using VARIABLE. Its just that the insert will not work.

    If I run this procedure from the SQL prompt, the procedure works very well.


    Prior to that, I also tried to use the exec_sql procedures, but the insert statement was not insert data.

    Can someone pls help me identify the problem?

    Engage?

    Concerning
    Peter

  • 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.

  • How to INSERT INTO a specific line?

    I have a form with a calendar on the top, below is a list of items to each with a checkbox.

    This is a wonderful Visual-

    Calendar

    Box | Col | Col | Col

    Box | Col | Col | Col

    Box | Col | Col | Col

    I want so you select the date and it passed into the database on the same line as that (definitely a multiple is better) that has been verified by the user.

    I was trying an INSERT INTO statement with a WHERE statement, but apparently you can do. So if I can use a WHERE with INSERT IN, how can I identify which line to insert the info?

    It is currently passing dates, but it creates a new line.

    I didn't post the code is neccisary power for this question, but if anyone wants to see what it let me know and I'll post it.

    Thank you!

    An INSERT operation will be * always * do exactly that, insert rows in a table.  It's sounds like maybe you should do a UPDATE operation instead.  Can you give a little more explanation on the design of database and table that represents each row of the table?  Maybe that walk through the interaction of the user more too?  And including the corresponding code is generally useful.

    -Carl V.

  • 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

  • INSERT INTO with SELECT CASE

    Hi all
    I have this problem: Insert Table_A Table_B values... with a derivatives/calculated filed.
    Example of
    INSERT INTO Table_A (id_part, vendtype, origin, proven, desc)
    SELECT id_p, vendt, origin, proven, <calculate/derivated_field_desc>
    FROM Table_B
    The rules for calculating the desc field inserted on Table_A are
    1. IF vendt='V' AND origin='N' AND proven!='04' THEN ---> desc='TRANSFER'
    2. IF vendt='M' AND origin='N' AND proven!='04' THEN ---> desc='IMPORTED'
    3. IF proven='04' THEN ---> desc='BAD'
    So what I use on my INSERT INTO statement < calculate/derivated_field_desc >?
    Can I use a SELECT BOX WHEN block... or only DECODE is a good solution?

    Published by: November 15, 2010 12.51 trebbia

    Two things I noticed: 1. you should remove the "SELECT" before the CASE and 2. There is an incompatibility of single quotation mark (').

  • 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 the table with the help of the string

    Hi all

    I have a string with commas.
    Is it possible to insert the values of string directly in the table in each column.

    For ex:

    v_str = "10,20,30,40";

    insert into v_tab (col1, col2, col3, col4) values (10,20,30,40);

    I would like to pass v_str instead of numbers in the insert statement.

    Thank you

    I try with this simple block
    DECLARE
      v_char VARCHAR2(1000) := '10,20'; 
      v_query VARCHAR2(3000); 
    BEGIN
      v_query := 'INSERT INTO week_bkgs(week_num, product_bkg) VALUES (:x)'; 
      EXECUTE IMMEDIATE v_query USING v_char; 
    END; 
    /
    How can achieve us if
    the column a. data types are the NUMBER
    b column data types are VARCHAR2

    Published by: polasa on October 30, 2008 21:20

    Try this

    SQL> set lines 100
    SQL> desc student;
     Name                                                  Null?    Type
     ----------------------------------------------------- -------- ------------------------------------
     NAME                                                           VARCHAR2(100)
     STUDENT_NUMBER                                                 NUMBER(10)
    
    SQL> declare
      2     str_v   varchar2(100) :='''abc'',1';
      3  begin
      4     execute immediate 'insert into student values ('|| str_v ||')';
      5  end;
      6  /
    
    PL/SQL procedure successfully completed.
    
    SQL> select * from student where student_number=1
      2  ;
    
    NAME                 STUDENT_NUMBER
    -------------------- --------------
    abc                               1
    
    SQL> 
    
  • Attempt to create run time (dynamic) table and insert the data in this... The entrance is a flat file (txt file) which has the numbers and strings... I'm trying to convert them to a string and insert into the table. It is a matter of urgency for me please

    create or replace procedure Dynamic_Table AS

    iVal VARCHAR2 (32);

    iTemp varchar (200): = ";

    sql_stmt VARCHAR2 (200);

    l_file1 UTL_FILE. TYPE_DE_FICHIER;

    l_file utl_file.file_type;

    BEGIN

    l_file1: = UTL_FILE. FOPEN ('TEST', 'dinput.txt', 'R');

    EXECUTE IMMEDIATE ' CREATE TABLE baseline (Item_ID varchar2 (32))';

    Loop

    BEGIN

    UTL_FILE. GET_LINE (l_file1, iVal);

    EXECUTE IMMEDIATE ' insert into baseline values (: ival) "using ival;

    EXCEPTION

    WHEN No_Data_Found THEN EXIT;

    While some OTHER THEN dbms_output.put_line (SQLERRM); * /

    END;

    end loop;

    END;

    You are approaching this the wrong way.  Create an external table based on the file.  External tables are CSV, fixed width data in a queryable table.

    You will need to create an oracle directory to put the file in (MY_ORA_DIR) I leave it for you to do, and then perform the following...

    create table BASELINE)

    ITEM_ID varchar2 (32)

    )

    EXTERNAL ORGANIZATION

    (

    TYPE ORACLE_LOADER

    THE DEFAULT DIRECTORY MY_ORA_DIR

    ACCESS SETTINGS

    (

    RECORDS DELIMITED BY NEWLINE

    LOGFILE "dinput.log".

    BADFILE "dinput.bad."

    NODISCARDFILE

    FIELDS

    (

    ITEM_ID

    )

    )

    LOCATION ("dinput.txt")

    )

    REJECT LIMIT UNLIMITED

    /

    All the dubious records appear in dinput.bad. Dinput.log will give you information.

    External tables are read-only, so once you set up your file, you can create editable as a normal table.

    create table ITABLE_EDITABLE as

    Select * from BASELINE

    /

    Work done, a few lines of code.

  • Two INSERT into a form

    Hello

    I am newbee on DW CS4, but I need to insert into 2 tables with a single shape. The first INSERT Inserts information into the 1st table (I'm ok for that), but the second INSERT must enter 'inf_city' and 'inf_idcountry' in the table 'city' ONLY if 'inf_city' AND 'inf_idcountry' does not exist in the ' town "table of s...

    So it is should be possible to have in the table 'city' the very name of the city, but with different countries...

    something like this:

    $ville = $_POST ['inf_city'];
    $country = $_POST ['inf_idcountry'];

    $req = mysql_query ("SELECT * FROM City WHERE cit_city AS $ville AND cit_idcountry AS $country");

    If ($req = "") / / If no match
    {
    mysql_query ("INSERT INTO city (cit_name, cit_idcou) VALUE ($ville, $country) '");

    mysql_close();
    }
    else / / OTHERWISE
    {
    no entry in the table
    }

    How to proceed with DW CS4?

    Am I clear?

    thx for your help

    Tim

    Tim, it looks like you have two types of users; suppliers that insert data into the table of infrastructure and consumers that the data content content research infrastructure.

    You don't really need a table separated town, you can fill the drop down with a select simple from the table of the infrastructure:

    Select distinct country, city infrastructure, whose country is $selected_country

    or something similar.

    There are reasons for which you can always use a separate City table:

    (1) performance. If the table of the infrastructure becomes very large (tens of thousands of lines) select to fill the bottom drop can become slow. But it depends on many factors and a simple performance index could easily fix that.

    (2) you want to limit the fall of the city down to include only the combinations valid city/country you inserted. But since you are authorizing providers insert cities, appears not to be a valid reason.

    (3) you want to prepopulate the paintings of the city to allow the consumer to content select the cities that may not be in the table of the infrastructure. It would be of little use, as their search returns zero rows anyway.

    Unless you manage the city table, and the table of the infrastructure does not grow very large, it can therefore not a reason to have the table of the city.

  • Extract the XML tags and insert into the table

    Description:

    XML is under inert atmosphere in the table containing the xmltype column. Need to extract value from xml tag and insert into the table.
    Once the XML record Treaty must update the status as 'Y' in the base table

    Problem:
    There are multiple occurrences of some tags that need to be combined and stored in a single column to delineate the '-'. No. area of occurrence can vary for each record.
    There are a few encrypted column that I managed to convert decoded value. But used select distinct... XMLTYPE...
    GTT table is used to store the intermediate result and decoding and the concatenation of several tags occurred using TWG.

    1.No. multiple tag will vary how to extract those and concatenate them into a single column. I assumed his occrrence in 3 for example: < student >
    2. how to set the value NULL if no tag is not present. Tag in XML record number can vary. I know that the complete list of xmltags.
    3 data not found error for some xml documents.

    Kindly Assits how to achieve this.

    version: 11.2.0.3.0

    Table Base: temp_XML

    XML_ID NOT NULL NUMBER (28) - auto-increment using the sequence
    PUBLIC EVENT. Stores the XMLTYPE STORAGE BINARY - XML file
    DATE OF EVTDATE
    STATUS VARCHAR2 (3) DEFAULT ' don't

    Sample XML: Includes all the brands mentioned in the common procedure below.

    <? XML version = "1.0" encoding = "US-ASCII"? >

    "< event xmlns ="http://xmlextrac.test.com/object">."

    < data xmlns = "" >

    < object >

    <>units

    < unit > TLAS < / unit >

    < unit > ATLAS < / unit >

    < / units >

    < receiverNetworks >

    < receiverNetwork > ABSAZAJ0XXXX < / receiverNetwork >

    < / receiverNetworks >

    < correspondentIds >

    < correspondentId > #SWF - ABSAZAJ0XXX < / correspondentId >

    < / correspondentIds >

    < comment >

    < comment / >

    < comment / >

    < comment / >

    < comment / >

    < / comment >

    < memo >

    < memo > 28 < / memo >

    < / memos >

    < tuxedoPriority > 20 < / tuxedoPriority >

    sender <>Mike < / sender >

    < typeReseauId > Message < / typeReseauId >

    < maxRetry > 4 < / maxRetry >

    < msgSecuLevel > CBA < / msgSecuLevel >

    < quantity >

    < amount > 12 < / amount >

    < amount > 34 < / amount >

    < amount > 56 < / amount >

    < / amounts >

    < currencys >

    < currency > $ < / currency >

    < currency > EUR < / currency >

    INR < currency > < / currency >

    < / currencys >

    < msgDateVal > ARST123 < / msgDateVal >

    wder < direction > < / direction >

    < eventType > 113 < / eventType >

    < date > 1407431619 < / date >

    < eventDate > 1407431624 < / eventDate >

    < management > R < / direction >

    < msgRef > R950140807AB6CBE < / msgRef >

    < format > SWF < / size >

    < type > 950 < / type >

    R950140807AB6CBE < WALL > < / WALL >

    < bankingPriority / >

    FSDS < field.20 > < / field.20 >

    < texteType > FSS < / texteType >

    < applicationCode > OHS < / applicationCode >

    < company > KETH < / company >

    < endFct > MOE < / endFct >

    < rate > BAM < / flow >

    < subtype / >

    < text > DQo6MjA6R0wxNDA4MDcwMDA1MTMNCjoyNTo3M == < / text >

    < msgHeaders > ezE6RjAxTE9ZRE5MMjBCWFhYMDAzMjAw = < / msgHeaders >

    < msgTrailer > ezU6e0NISzpEOUFFRUNCN0NBQTl9e1RORzp9fQ == < / msgTrailer >

    < / object >

    < / data >

    Procedure: This works very well for a few xml record and fails for some.

    CREATE OR REPLACE PROCEDURE XML_EXTR
    AS
    CURSOR c1
    IS
    SELECT * FROM temp_XML;

    c1_cur c1% ROWTYPE;

    bamdata_sql VARCHAR2 (3000);
    d_text VARCHAR2 (3000);
    d_msgHeaders VARCHAR2 (3000);
    d_msgTrailer VARCHAR2 (3000);
    x_text VARCHAR2 (3000);
    x_msgHeaders VARCHAR2 (3000);
    x_msgTrailer VARCHAR2 (3000);
    x_eventType VARCHAR2 (3000);
    x_amount number (28.2).
    x_currency VARCHAR2 (3000);
    x_state VARCHAR2 (3000);
    x_units VARCHAR2 (3000);
    x_correspondentId VARCHAR2 (3000);
    X_TYPE VARCHAR2 (3000);
    x_receiverNetworks VARCHAR2 (3000);
    x_bankingPriority VARCHAR2 (3000);
    x_applicationCode VARCHAR2 (3000);
    x_processCounter VARCHAR2 (3000);
    x_obsolescence VARCHAR2 (3000);
    x_maxRetry VARCHAR2 (3000);
    x_retries VARCHAR2 (3000);
    x_fileSize VARCHAR2 (3000);
    x_endFct VARCHAR2 (3000);
    x_subType VARCHAR2 (3000);
    x_field20 VARCHAR2 (3000);
    x_sequenceNumber VARCHAR2 (3000);
    x_requestorDn VARCHAR2 (3000);
    x_responderDn VARCHAR2 (3000);
    x_SWIFTNetService VARCHAR2 (3000);
    x_transfertRef VARCHAR2 (3000);
    x_nonrepudiation VARCHAR2 (3000);
    x_transfertInfo VARCHAR2 (3000);
    x_fileDesc VARCHAR2 (3000);
    x_transfertDesc VARCHAR2 (3000);
    x_logicalName VARCHAR2 (3000);
    x_signIndicator VARCHAR2 (3000);
    x_critId VARCHAR2 (3000);
    x_inFapId VARCHAR2 (3000);
    x_deliveryNotif VARCHAR2 (3000);
    x_comment1 VARCHAR2 (3000);
    x_comment2 VARCHAR2 (3000);
    x_comment3 VARCHAR2 (3000);
    x_comment4 VARCHAR2 (3000);
    x_comments VARCHAR2 (3000);
    x_memo1 VARCHAR2 (3000);
    x_memo2 VARCHAR2 (3000);
    x_memo3 VARCHAR2 (3000);
    x_memo4 VARCHAR2 (3000);
    x_msgSecuLevel VARCHAR2 (3000);
    x_dates VARCHAR2 (3000);
    x_tuxedoPriority VARCHAR2 (3000);
    x_fileDest VARCHAR2 (3000);
    x_stkMsgPDEId VARCHAR2 (3000);
    x_EMTId VARCHAR2 (3000);
    x_LTRcptSyno VARCHAR2 (3000);
    x_LTRcpt VARCHAR2 (3000);
    x_LTEmis VARCHAR2 (3000);
    x_flow VARCHAR2 (3000);
    x_FINCopy VARCHAR2 (3000);
    x_msgDateVal VARCHAR2 (3000);
    x_eventDate VARCHAR2 (3000);
    x_typeReseauId VARCHAR2 (3000);
    x_inFapSeq1 VARCHAR2 (3000);
    x_inFapSeq2 VARCHAR2 (3000);
    x_direction VARCHAR2 (3000);
    x_priority VARCHAR2 (3000);
    x_ack VARCHAR2 (3000);
    x_format VARCHAR2 (3000);
    x_mur VARCHAR2 (3000);
    x_TexteType VARCHAR2 (3000);
    x_creatingUser VARCHAR2 (3000);
    x_fileinfo VARCHAR2 (3000);
    x_company VARCHAR2 (3000);
    x_language VARCHAR2 (3000);
    x_ackText VARCHAR2 (3000);
    x_jaxbRef VARCHAR2 (3000);
    x_jaxbElt VARCHAR2 (3000);
    x_memos VARCHAR2 (3000);
    xmlid number (28);
    x_msgRef1 VARCHAR2 (3000);
    x_msgRef2 VARCHAR2 (3000);
    x_msgRef3 VARCHAR2 (3000);
    x_msgRef4 VARCHAR2 (3000);
    x_sender VARCHAR2 (3000);
    x_amlBehavior VARCHAR2 (3000);
    x_ownerServiceId VARCHAR2 (3000);
    x_correspondentName VARCHAR2 (3000);
    x_correspondentAddress1 VARCHAR2 (3000);
    x_correspondentAddress2 VARCHAR2 (3000);
    x_correspondentAddress3 VARCHAR2 (3000);
    x_correspondentAddress4 VARCHAR2 (3000);
    x_correspondentCity VARCHAR2 (3000);
    x_correspondentCountry VARCHAR2 (3000);
    x_correspondentNetworkAddr VARCHAR2 (3000);
    x_tested VARCHAR2 (3000);
    x_correspondentNetwork VARCHAR2 (3000);
    x_validatedPercentage VARCHAR2 (3000);
    x_nbOfValid VARCHAR2 (3000);
    x_requestRef VARCHAR2 (3000);
    x_notifQueue VARCHAR2 (3000);
    x_requestType VARCHAR2 (3000);
    x_secBpid VARCHAR2 (3000);
    x_queue VARCHAR2 (3000);
    x_receiverCode VARCHAR2 (3000);
    x_receiverInd VARCHAR2 (3000);
    x_validFlag VARCHAR2 (3000);
    x_ownerId VARCHAR2 (3000);
    x_dn VARCHAR2 (3000);
    x_RMAOurBic VARCHAR2 (3000);
    x_RMACorrespondentBic VARCHAR2 (3000);
    x_RMAService VARCHAR2 (3000);
    x_fileMsgRef VARCHAR2 (3000);
    date of x_ext_date;
    x_correspondentAddress VARCHAR2 (3000);
    x_msgrefs varchar2 (3000);
    d_ackText varchar2 (3000);
    ackText varchar2 (3000);
    date of x_extdate;

    BEGIN

    FOR C1_CUR IN C1

    LOOP

    INSERT INTO data_GTT_TEMP)
    eventType, amount, currency, State, units, correspondentId, sender, receiverNetworks, bankingPriority, applicationCode, processCounter.
    obsolescence, maxRetry, reminders, fileSize, endFct, xsubType, field.20, sequenceNumber, requestorDn, responderDn, SWIFTNetService, non-repudiation,
    transfertRef, transfertInfo, fileDesc, transfertDesc, logicalName, signIndicator, critId, inFapId, deliveryNotif, comment1, comment2, comment3, comment4,
    Memo1, memo2, memo3, memo4, msgSecuLevel, dates, tuxedoPriority, fileDest, stkMsgPDEId, EMTId, LTRcptSyno, LTRcpt, LTEmis, flow, FINCopy, msgDateVal,
    eventDate, typeReseauId, inFapSeq1, inFapSeq2, direction, priority, ack,
    msgRef1, msgRef2, msgRef3, msgRef4, amlbehavior, correspondentName, ownerServiceId,
    correspondentAddress1, correspondentAddress2, correspondentAddress3, correspondentAddress4,
    correspondentCity, correspondentCountry, correspondentNetworkAddr, tested,
    correspondentNetwork, validatedPercentage, nbOfValid, requestRef, notifQueue,
    requestType, secBpid, xqueue, receiverCode, receiverInd, validFlag, ownerId, dn, RMAOurBic, RMACorrespondentBic, RMAService,
    fileMsgRef, format, xtype, wall, TexteType, creatingUser, fileinfo,
    company, text, xlanguage, ackText, msgHeaders, msgTrailer, jaxbRef, jaxbElt)
    SELECT
    x.eventType, x.amount, x.currency, x.state, x.units, x.correspondentId, x.sender, x.receiverNetworks, x.bankingPriority, x.applicationCode, x.processCounter,
    x.obsolescence, x.maxRetry, x.Retries, x.FileSize, x.endFct, x.xsubType, x.Field20, x.SequenceNumber, x.requestorDn, x.responderDn, x.SWIFTNetService, x.nonRepudiation,
    x.transfertRef, x.transfertInfo, x.fileDesc, x.transfertDesc, x.logicalName, x.signIndicator, x.critId, x.inFapId, x.deliveryNotif, x.comment1, x.comment2,
    x.comment3, x.comment4, x.Memo1, x.memo2, x.memo3, x.MEMO4, x.msgSecuLevel, x.dates, x.tuxedoPriority, x.fileDest, x.stkMsgPDEId, x.EMTId, x.LTRcptSyno,
    x.LTRcpt, x.LTEmis, x.flow, x.FINCopy, x.msgDateVal, x.eventDate, x.typeReseauId, x.inFapSeq1, x.inFapSeq2, x.direction, x.priority, x.ack,
    x.msgRef1, x.msgRef2, x.msgRef3, x.msgRef4, x.amlbehavior, x.correspondentName, x.ownerServiceId,
    x.correspondentAddress1, x.correspondentAddress2, x.correspondentAddress3, x.correspondentAddress4,
    x.correspondentCity, x.correspondentCountry, x.correspondentNetworkAddr, x.tested,
    x.correspondentNetwork, x.validatedPercentage, x.nbOfValid, x.requestRef, x.notifQueue,
    x.requestType, x.secBpid, x.xqueue, x.receiverCode, x.receiverInd, x.validFlag, x.ownerId, x.dn, x.RMAOurBic, x.RMACorrespondentBic, x.RMAService,
    x.fileMsgRef, x.format, x.xtype, x.mur, x.TexteType, x.creatingUser, x.fileinfo,
    x.Company, x.Text, x.xLanguage, x.ackText, x.msgHeaders, x.msgTrailer, x.jaxbRef, x.jaxbElt

    of temp_XML t, XMLTABLE (XMLNAMESPACES ('http://xmlextrac.test.com/object' as "ns0"), ' / ns0:event' )
    PASSAGE t.BAM_EVENT COLUMNS
    eventType varchar2 (3000) PATH 'data, object, eventType' DEFAULT NULL,
    amount number (28.2) path data/object/amounts"."
    currency varchar2 (3000) PATH 'data, object, currencys, currency' DEFAULT NULL,
    VARCHAR2 (3000) path "data/object / / state of ' DEFAULT NULL, State
    units varchar2 (3000) PATH ' object/data/units' DEFAULT NULL,
    correspondentId varchar2 (3000) PATH "data/object/correspondentIds' DEFAULT NULL,
    sender varchar2 (3000) PATH 'data, object, sender' DEFAULT NULL,
    receiverNetworks varchar2 (3000) PATH "data/object/receiverNetworks' DEFAULT NULL,
    bankingPriority varchar2 (3000) PATH "data/object/bankingPriority' DEFAULT NULL,
    applicationCode varchar2 (3000) PATH ' object/data/applicationCode' DEFAULT NULL,
    processCounter varchar2 (3000) PATH "data/object/processCounter' DEFAULT NULL,
    obsolescence varchar2 (3000) PATH ' data/object/obsolescence' DEFAULT NULL,
    maxRetry varchar2 (3000) PATH ' data/object/maxRetry' DEFAULT NULL,
    attempts to varchar2 (3000) "data/object/attempts" DEFAULT NULL path,.
    size of the file varchar2 (3000) PATH ' data/object/fileSize' DEFAULT NULL,
    endFct varchar2 (3000) PATH "data/object/endFct' DEFAULT NULL,
    xsubType varchar2 (3000) PATH "data/object/subtype' DEFAULT NULL,
    field.20 varchar2 (3000) PATH ' object/data/field.20' DEFAULT NULL,
    sequenceNumber varchar2 (3000) PATH "data/object/sequenceNumber" DEFAULT NULL,
    requestorDn varchar2 (3000) PATH "data/object/requestorDn' DEFAULT NULL,
    responderDn varchar2 (3000) PATH "data/object/responderDn' DEFAULT NULL,
    SWIFTNetService varchar2 (3000) PATH "data/object/SWIFTNetService' DEFAULT NULL,
    non-repudiation varchar2 (3000) PATH ' object/data/repudiation' DEFAULT NULL,
    transfertRef varchar2 (3000) PATH "data/object/transfertRef' DEFAULT NULL,
    transfertInfo varchar2 (3000) PATH "data/object/transfertInfo' DEFAULT NULL,
    fileDesc varchar2 (3000) PATH "data/object/fileDesc' DEFAULT NULL,
    transfertDesc varchar2 (3000) PATH "data/object/transfertDesc' DEFAULT NULL,
    logicalName varchar2 (3000) PATH "data/object/logicalName" DEFAULT NULL,
    signIndicator varchar2 (3000) PATH "data/object/signIndicator' DEFAULT NULL,
    critId varchar2 (3000) PATH "data/object/critId' DEFAULT NULL,
    inFapId varchar2 (3000) PATH "data/object/inFapId' DEFAULT NULL,
    deliveryNotif varchar2 (3000) PATH "data/object/deliveryNotif' DEFAULT NULL,
    COMMENT1 varchar2 (3000) PATH ' data, subject, comments, comment [1] "DEFAULT NULL,
    comment2 varchar2 (3000) PATH 'data, subject, comments, how [2]' DEFAULT NULL,
    comment3 varchar2 (3000) PATH "data/object/observations/comments [3]" DEFAULT NULL,
    comment4, varchar2 (3000) PATH ' data, subject, comments, comment [4] "DEFAULT NULL,
    Memo1 varchar2 (3000) PATH "data/object/memos/memo [1]" DEFAULT NULL,
    Memo2 varchar2 (3000) PATH "data/object/notes/Notes [2]" DEFAULT NULL,
    memo3 varchar2 (3000) PATH "data/object/memos/memo [3]" DEFAULT NULL,
    MEMO4 varchar2 (3000) PATH "data/object/memos/memo [4]" DEFAULT NULL,
    msgSecuLevel varchar2 (3000) PATH "data/object/msgSecuLevel' DEFAULT NULL,
    Date varchar2 (3000) PATH ' object/data/date' DEFAULT NULL,
    tuxedoPriority varchar2 (3000) PATH "data/object/tuxedoPriority' DEFAULT NULL,
    fileDest varchar2 (3000) PATH "data/object/fileDest' DEFAULT NULL,
    stkMsgPDEId varchar2 (3000) PATH "data/object/stkMsgPDEId' DEFAULT NULL,
    EMTId varchar2 (3000) PATH "data/object/EMTId' DEFAULT NULL,
    LTRcptSyno varchar2 (3000) PATH "data/object/LTRcptSyno' DEFAULT NULL,
    LTRcpt varchar2 (3000) PATH "data/object/LTRcpt' DEFAULT NULL,
    LTEmis varchar2 (3000) PATH "data/object/LTEmis' DEFAULT NULL,
    flow varchar2 (3000) PATH "/ object/data flow ' DEFAULT NULL,
    FINCopy varchar2 (3000) PATH ' data/object/FINCopy' DEFAULT NULL,
    msgDateVal varchar2 (3000) PATH "data/object/msgDateVal' DEFAULT NULL,
    eventDate varchar2 (3000) PATH "data/object/eventDate" DEFAULT NULL,
    typeReseauId varchar2 (3000) PATH "data/object/typeReseauId' DEFAULT NULL,
    inFapSeq1 varchar2 (3000) PATH "data/object/inFapSeq1' DEFAULT NULL,
    inFapSeq2 varchar2 (3000) PATH "data/object/inFapSeq2' DEFAULT NULL,
    direction varchar2 (3000) PATH 'data, object, direction' DEFAULT NULL,
    priority varchar2 (3000) PATH ' data/object/priority' DEFAULT NULL,
    ACK varchar2 (3000) PATH ' object/data/ack' DEFAULT NULL,
    msgRef1 varchar2 (3000) PATH ' data, object, msgRefs, msgRef [1] "DEFAULT NULL,
    msgRef2 varchar2 (3000) PATH ' data, object, msgRefs, msgRef [2] "DEFAULT NULL,
    msgRef3 varchar2 (3000) PATH ' data, object, msgRefs, msgRef [3] "DEFAULT NULL,
    msgRef4 varchar2 (3000) PATH ' data, object, msgRefs, msgRef [4] "DEFAULT NULL,
    amlBehavior varchar2 (3000) PATH "data/object/amlBehavior' DEFAULT NULL,
    ownerServiceId varchar2 (3000) PATH "data/object/ownerServiceId' DEFAULT NULL,
    correspondentName varchar2 (3000) PATH ' data/object/correspondentName' DEFAULT NULL,
    PATH of VARCHAR2 (3000) of correspondentAddress1 ' object/data/correspondentLine1Addresse' DEFAULT NULL,
    PATH of VARCHAR2 (3000) of correspondentAddress2 ' object/data/correspondentLine2Addresse' DEFAULT NULL,
    PATH of VARCHAR2 (3000) of correspondentAddress3 ' object/data/correspondentLine3Addresse' DEFAULT NULL,
    PATH of VARCHAR2 (3000) of correspondentAddress4 ' object/data/correspondentLine4Addresse' DEFAULT NULL,
    correspondentCity PATH VARCHAR2 (3000) ' object/data/correspondentCity' DEFAULT NULL,
    correspondentCountry PATH VARCHAR2 (3000) ' object/data/correspondentCountry' DEFAULT NULL,
    correspondentNetworkAddr PATH VARCHAR2 (3000) ' object/data/correspondentNetworkAddr' DEFAULT NULL,
    tested VARCHAR2 (3000) PATH ' data/object/tested' DEFAULT NULL,
    correspondentNetwork PATH VARCHAR2 (3000) ' object/data/correspondentNetwork' DEFAULT NULL,
    validatedPercentage PATH VARCHAR2 (3000) ' object/data/validatedPercentage' DEFAULT NULL,
    nbOfValid PATH VARCHAR2 (3000) ' object/data/nbOfValid' DEFAULT NULL,
    requestRef VARCHAR2 (3000) PATH ' data/object/requestRef' DEFAULT NULL,
    notifQueue PATH VARCHAR2 (3000) ' object/data/notifQueue' DEFAULT NULL,
    requestType PATH VARCHAR2 (3000) ' data/object/requestType' DEFAULT NULL,
    secBpid PATH VARCHAR2 (3000) ' object/data/secBpid' DEFAULT NULL,
    xqueue PATH VARCHAR2 (3000) ' data/object/tail' DEFAULT NULL,
    receiverCode PATH VARCHAR2 (3000) ' object/data/receiverCode' DEFAULT NULL,
    receiverInd PATH VARCHAR2 (3000) ' object/data/receiverInd' DEFAULT NULL,
    validFlag PATH VARCHAR2 (3000) ' object/data/validFlag' DEFAULT NULL,
    ownerId PATH VARCHAR2 (3000) ' data/object/ownerId' DEFAULT NULL,
    DN VARCHAR2 (3000) PATH ' data/object/dn' DEFAULT NULL,
    PATH of VARCHAR2 (3000) of RMAOurBic ' object/data/RMAOurBic' DEFAULT NULL,
    PATH of VARCHAR2 (3000) of RMACorrespondentBic ' object/data/RMACorrespondentBic' DEFAULT NULL,
    PATH of VARCHAR2 (3000) of RMAService ' object/data/RMAService' DEFAULT NULL,
    fileMsgRef PATH VARCHAR2 (3000) ' object/data/fileMsgRef' DEFAULT NULL,
    ackText varchar2 (3000) PATH "data/object/ackText' DEFAULT NULL,
    format varchar2 (3000) PATH "data/object / ' DEFAULT NULL,
    xType varchar2 (3000) PATH ' data/object/type' DEFAULT NULL,
    Wall varchar2 (3000) PATH ' data/object/wall' DEFAULT NULL,
    texteType varchar2 (3000) PATH "data/object/texteType' DEFAULT NULL,
    creatingUser varchar2 (3000) PATH ' data/object/creatingUser' DEFAULT NULL,
    fileInfo varchar2 (3000) PATH ' data/object/fileInfo' DEFAULT NULL,
    VARCHAR2 (3000) path ' data/object/society' DEFAULT NULL, the company
    VARCHAR2 (3000) text ' data/object/text' DEFAULT NULL path.
    xLanguage varchar2 (3000) PATH ' data/object/language' DEFAULT NULL,
    msgHeaders varchar2 (3000) PATH "data/object/msgHeaders' DEFAULT NULL,
    msgTrailer varchar2 (3000) PATH "data/object/msgTrailer' DEFAULT NULL,
    jaxbRef varchar2 (3000) PATH ' info/jaxbRef' DEFAULT NULL,
    jaxbElt varchar2 (3000) PATH "jaxbElt/info") x
    where t.XML_ID = c1_cur. XML_ID and t.status =' no;

    Select x.text, x.msgHeaders, x.msgTrailer in x_msgTrailer, x_msgHeaders, x_text of
    temp_XML t, XMLTABLE (XMLNAMESPACES ('http://xmlextrac.test.com/object' as "ns0"), ' / ns0:event' )
    PASSAGE t.BAM_EVENT COLUMNS
    text varchar2 (3000) PATH data/object/text"."
    msgHeaders varchar2 (3000) PATH "data/object/msgHeaders,"
    msgTrailer varchar2 (3000) PATH "object/data/msgTrailer.
    ) x
    where t.XML_ID = c1_cur. XML_ID;
    Select sysdate in double x_extdate;


    d_text: = utl_raw.cast_to_varchar2 (utl_encode.base64_decode (utl_raw.cast_to_RAW (x_text)));
    d_msgHeaders: = utl_raw.cast_to_varchar2 (utl_encode.base64_decode (utl_raw.cast_to_RAW (x_msgHeaders)));
    d_msgTrailer: = utl_raw.cast_to_varchar2 (utl_encode.base64_decode (utl_raw.cast_to_RAW (x_msgTrailer)));
    -d_ackText: = utl_raw.cast_to_varchar2 (utl_encode.base64_decode (utl_raw.cast_to_RAW (ackText)));

    Select
    EventType, amount, currency, State, units, correspondentid, sender, receivernetworks, bankingpriority,
    applicationcode, processcounter, obsolescence, maxretry, reminders, filesize, endfct, xsubtype, field.20, sequencenumber, requestordn,
    responderdn, swiftnetservice, non repudiation, transfertref, transfertinfo, filedesc, transfertdesc, logicalname, signindicator,
    critid, infapid, deliverynotif, comment1, comment2, comment3, comment4, memo1, memo2, memo3, memo4, msgseculevel, dates, tuxedopriority, filedest,
    stkmsgpdeid, emtid, ltrcptsyno, ltrcpt, ltemis, flow, fincopy, msgdateval, eventdate, typereseauid, infapseq1,
    infapseq2, direction, priority, ack, msgref1, msgref2, msgref3, msgref4, amlbehavior, ownerserviceid, correspondentname, correspondentaddress1, correspondentaddress2, correspondentaddress3, correspondentaddress4,
    correspondentcity, correspondentcountry, correspondentnetworkaddr, test, correspondentnetwork, validatedpercentage, nbofvalid,.
    requestref, notifqueue, requesttype, secbpid, xqueue, receivercode, receiverind, validflag, ownerid, dn, rmaourbic, rmacorrespondentbic, rmaservice, filemsgref,
    acktext, format, xtype, wall, textetype, creatinguser, fileinfo, society, text, xlanguage, msgheaders, msgtrailer, jaxbref, jaxbelt
    in
    x_eventtype, x_amount, x_currency, x_state, x_units, x_correspondentid, x_sender, x_receivernetworks, x_bankingpriority, x_applicationcode, x_processcounter,
    x_obsolescence, x_maxretry, x_retries, x_filesize, x_endfct, x_subtype, x_field20, x_sequencenumber, x_requestordn, x_responderdn, x_swiftnetservice, x_nonrepudiation,
    x_transfertref, x_transfertinfo, x_filedesc, x_transfertdesc, x_logicalname, x_signindicator, x_critid, x_infapid, x_deliverynotif, x_comment1, x_comment2, x_comment3,
    x_comment4, x_memo1, x_memo2, x_memo3, x_memo4, x_msgseculevel, x_dates, x_tuxedopriority, x_filedest, x_stkmsgpdeid, x_emtid, x_ltrcptsyno, x_ltrcpt,
    x_ltemis, x_flow, x_fincopy, x_msgdateval, x_eventdate, x_typereseauid, x_infapseq1, x_infapseq2, x_direction, x_priority, x_ack, x_msgref1, x_msgref2,
    x_msgref3, x_msgref4, x_amlbehavior, x_ownerserviceid, x_correspondentname, x_correspondentaddress1, x_correspondentaddress2, x_correspondentaddress3,
    x_correspondentaddress4, x_correspondentcity, x_correspondentcountry, x_correspondentnetworkaddr, x_tested, x_correspondentnetwork, x_validatedpercentage,
    x_nbofvalid, x_requestref, x_notifqueue, x_requesttype, x_secbpid, x_queue, x_receivercode, x_receiverind, x_validflag, x_ownerid, x_dn, x_rmaourbic,
    x_rmacorrespondentbic, x_rmaservice, x_filemsgref, x_acktext, x_format, x_type, x_mur, x_textetype, x_creatinguser, x_fileinfo, x_company, x_text,
    x_language, x_msgheaders, x_msgtrailer, x_jaxbref, data_GTT_TEMP x_jaxbelt;

    x_memos: = x_memo1 | » -'|| x_memo2 | » -'|| x_memo3 | » -'|| x_memo4;
    x_comments: = x_comment1 | » -'|| x_comment2 | » -'|| x_comment3 | » -'|| x_comment4;
    x_correspondentAddress: = x_correspondentAddress1 | » -'|| x_correspondentAddress2 | » -'|| x_correspondentAddress3 | » -'|| x_correspondentAddress4;
    x_msgrefs: = x_msgRef1 | » -'|| x_msgRef2 | » -'|| x_msgRef3 | » -'|| x_msgRef4;

    BEGIN


    insert into donnees_xml
    (xml_id, x_ext_date, eventtype, amount, currency, State, unit, correspondentid, sender, receivernetworks, bankingpriority, applicationcode,
    ProcessCounter, obsolescence, maxretry, reminders, filesize, endfct, xsubtype, field.20, sequencenumber, requestordn, responderdn,
    swiftnetservice, non repudiation, transfertref, transfertinfo, filedesc, transfertdesc, logicalname, signindicator, critid, infapid,
    deliverynotif, comments, notes, msgseculevel, dates, tuxedopriority, filedest, stkmsgpdeid, emtid, ltrcptsyno, ltrcpt, ltemis, flow,
    FINCopy, msgdateval, eventdate, typereseauid, infapseq1, infapseq2, direction, priority, ack, msgrefs, amlbehavior, ownerserviceid,
    correspondentName correspondentaddress, correspondentcity, correspondentcountry, correspondentnetworkaddr, tested,
    correspondentnetwork, validatedpercentage, nbofvalid, requestref, notifqueue, requesttype, secbpid, xqueue, receivercode,
    receiverind, validflag, ownerid, dn, rmaourbic, rmacorrespondentbic, rmaservice, filemsgref, acktext, format, xtype, wall,
    textetype, creatinguser, fileinfo, society, text, xlanguage, msgheaders, msgtrailer, jaxbref, jaxbelt)
    values
    (xmlid, x_extdate, x_eventType, x_amount, x_currency, x_state, x_units, x_correspondentId, x_sender, x_receiverNetworks, x_bankingPriority, x_applicationCode,
    x_processCounter, x_obsolescence, x_maxRetry, x_retries, x_fileSize, x_endFct, x_subType, x_field20, x_sequenceNumber, x_requestorDn, x_responderDn,
    x_SWIFTNetService, x_nonRepudiation, x_transfertRef, x_transfertInfo, x_fileDesc, x_transfertDesc, x_logicalName, x_signIndicator, x_critId, x_inFapId,
    x_deliveryNotif, x_comments, x_memos, x_msgSecuLevel, x_dates, x_tuxedoPriority, x_fileDest, x_stkMsgPDEId, x_EMTId, x_LTRcptSyno, x_LTRcpt, x_LTEmis, x_flow,
    x_FINCopy, x_msgDateVal, x_eventDate, x_typeReseauId, x_inFapSeq1, x_inFapSeq2, x_direction, x_priority, x_ack, x_msgrefs, x_amlbehavior, x_ownerServiceId,
    x_correspondentName, x_correspondentAddress, x_correspondentCity, x_correspondentCountry, x_correspondentnetworkaddr, x_tested,
    x_correspondentNetwork, x_validatedPercentage, x_nbOfValid, x_requestRef, x_notifQueue, x_requestType, x_secBpid, x_queue, x_receiverCode,
    x_receiverInd, x_validFlag, x_ownerId, x_dn, x_RMAOurBic, x_RMACorrespondentBic, x_RMAService, x_fileMsgRef, ackText, x_format, x_type, x_mur,
    x_TexteType, x_creatingUser, x_fileinfo, x_company d_text, x_language, d_msgHeaders, d_msgTrailer, x_jaxbRef, x_jaxbElt);

    Update temp_XML set status = 'Y' where XML_ID = xmlid;

    END;
    COMMIT;
    END LOOP;
    END;
    /

    1.No. multiple tag will vary how to extract those and concatenate them into a single column. I assumed that his occrrence in 3 for example:

    Use the fn:string-join() function:

    path varchar2 (4000) of comments 'string-join(comments/comment, "-").

    2. how to set the value NULL if no tag is not present. Tag in XML record number can vary.

    You don't have anything specific to do in this case.

    Missing tags with a projection in the COLUMNS clause will produce a column NULL by default.

Maybe you are looking for