begin\r\nmerge into kolesa_brands tusing (select 4 id, ARO name from dual) n on ( t.id = n.id)when matched thenupdate set t.name = n.namewhen not matched theninsert (t.id, t.name) values (n.id, n.name)\r\nmerge into kolesa_brands tusing (select 1 id, Acura name from dual) n on ( t.id = n.id)when matched thenupdate set t.name = n.namewhen not matched theninsert (t.id, t.name) values (n.id, n.name)\r\nmerge into kolesa_brands tusing (select 2 id, Alfa Romeo name from dual) n on ( t.id = n.id)when matched thenupdate set t.name = n.namewhen not matched theninsert (t.id, t.name) values (n.id, n.name)\r\nmerge into kolesa_brands tusing (select 3 id, Alpina name from dual) n on ( t.id = n.id)when matched thenupdate set t.name = n.namewhen not matched theninsert (t.id, t.name) values (n.id, n.name)\r\nmerge into kolesa_brands tusing (select 6 id, Aston Martin name from dual) n on ( t.id = n.id)when matched thenupdate set t.name = n.namewhen not matched theninsert (t.id, t.name) values (n.id, n.name)\r\nmerge into kolesa_brands tusing (select 7 id, Audi name from dual) n on ( t.id = n.id)when matched thenupdate set t.name = n.namewhen not matched theninsert (t.id, t.name) values (n.id, n.name)\r\nmerge into kolesa_brands tusing (select 150 id, BAW name from dual) n on ( t.id = n.id)when matched thenupdate set t.name = n.namewhen not matched theninsert (t.id, t.name) values (n.id, n.name)\r\nmerge into kolesa_brands tusing (select 11 id, BMW name from dual) n on ( t.id = n.id)when matched thenupdate set t.name = n.namewhen not matched theninsert (t.id, t.name) values (n.id, n.name)\r\nmerge into kolesa_brands tusing (select 15 id, BYD name from dual) n on ( t.id = n.id)when matched thenupdate set t.name = n.namewhen not matched theninsert (t.id, t.name) values (n.id, n.name)\r\nmerge into kolesa_brands tusing (select 9 id, Bentley name from dual) n on ( t.id = n.id)when matched thenupdate set t.name = n.namewhen not matched theninsert (t.id, t.name) values (n.id, n.name)\r\nmerge into kolesa_brands tusing (select 140 id, Brilliance name from dual) n on ( t.id = n.id)when matched thenupdate set t.name = n.namewhen not matched theninsert (t.id, t.name) values (n.id, n.name)\r\nmerge into kolesa_brands tusing (select 14 id, Buick name from dual) n on ( t.id = n.id)when matched thenupdate set t.name = n.namewhen not matched theninsert (t.id, t.name) values (n.id, n.name)\r\nmerge into kolesa_brands tusing (select 16 id, Cadillac name from dual) n on ( t.id = n.id)when matched thenupdate set t.name = n.namewhen not matched theninsert (t.id, t.name) values (n.id, n.name)\r\nmerge into kolesa_brands tusing (select 17 id, Chana name from dual) n on ( t.id = n.id)when matched thenupdate set t.name = n.namewhen not matched theninsert (t.id, t.name) values (n.id, n.name)\r\nmerge into kolesa_brands tusing (select 122 id, Changan name from dual) n on ( t.id = n.id)when matched thenupdate set t.name = n.namewhen not matched theninsert (t.id, t.name) values (n.id, n.name)\r\nmerge into kolesa_brands tusing (select 18 id, Chery name from dual) n on ( t.id = n.id)when matched thenupdate set t.name = n.namewhen not matched theninsert (t.id, t.name) values (n.id, n.name)\r\nmerge into kolesa_brands tusing (select 19 id, Chevrolet name from dual) n on ( t.id = n.id)when matched thenupdate set t.name = n.namewhen not matched theninsert (t.id, t.name) values (n.id, n.name)\r\nmerge into kolesa_brands tusing (select 20 id, Chrysler name from dual) n on ( t.id = n.id)when matched thenupdate set t.name = n.namewhen not matched theninsert (t.id, t.name) values (n.id, n.name)
Warning: oci_execute(): ORA-06550: line 1, column 6: PLS-00103: Encountered the symbol "\" when expecting one of the following: ( begin case declare exit for goto if loop mod null pragma raise return select update while with << continue close current delete fetch lock inser...
for ($i = 0; $i < count($router); $i++) {
$query = "MERGE INTO CORE_INTERFACES USING dual ON "
// The next row is the match criteria, like If "HOSTNAME" AND "IFINDEX" exist, Then Update else INSERT NEW HOSTNAMES!
. "( HOSTNAME = '" . $hostname . "' AND IFINDEX = '" . t trim($router_interface[0]) . "')"
. "WHEN MATCHED THEN UPDATE SET "
. "IFNAME = '" . trim($router_interface[1]) . "',IFTYPE = '" . trim(clean_iftype($router_interface[2])) . "',IFADMINSTATUS = '" . trim(clean_output($router_interface[3])) . "',"
. "LAST_UPDATE = CURRENT_TIMESTAMP "
. "WHEN NOT MATCHED THEN INSERT ("
. "IF_ID,HOSTNAME,IFINDEX,IFNAME,IFTYPE,IFADMINSTATUS,"
. "FIRST_SEEN "
. ") VALUES ("
. " core_interfaces_seq.nextval, "
. "'" . $hostname . "'," //$HOSTNAME
. "'" . trim($router_interface[0]) . "'," //ifIndex
. "'" . trim($router_interface[1]) . "'," //ifName
. "'" . trim(clean_iftype($router_interface[2])) . "'," //ifType
. "'" . trim(clean_output($router_interface[3])) . "'," //ifAdminState
. " CURRENT_TIMESTAMP )";
$stid = oci_parse($gnedb, $sql);
}
MERGE
INTO users_dest dest
USING( SELECT 1 user_id, 10 points FROM dual) src
ON( dest.user_id = src.user_id )
WHEN MATCHED THEN
UPDATE SET points = src.points
WHEN NOT MATCHED THEN
INSERT( user_id, points )
VALUES( src.user_id, src.points );