sql - ORA-00917: missing comma when insert not exist in oracle -


i have query :

insert kontak (idkontak, nama, nohp, alamat, groupkontak_fk) values  (sq_idkontak.nextval, 'andika pratama', '+6285226202202', 'jpr', '' not exists (select * kontak nama = 'amin')) 

i want insert data kontak table based on values not exist in kontak nama='amin'.

when ran got error :

ora-00917: missing comma

any suggestion?

if trying conditional insert, can either use merge, or use this, assuming want insert 'andika pratama' if 'amin' not there (which doesn't make sense me, seems goal):

insert table1(id1, col1, col2)   select sequence1.nextval, 'val1', 'val2'     dual     not exists (select 1 table1 col1 = 'amin') 

http://docs.oracle.com/cd/b19306_01/server.102/b14200/statements_9014.htm


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -