I have a problem with running SQL with ADO RecordSet.
I have 2 table with same structure, 1 table to temporary use.
( Table1 and Table2 ) structure:
KODE VARCHAR2(5)
KET VARCHAR2(30)
Table1 data:
--------------------
KODE KET
001 AAAAAAAA
002 BBBBBBBB
003 CCCCCCCC
Table2 data: is empty
if i want to add record from table1 to table2, than error
insert into table2 ( select * from table1 ); --> error
but, i do it with long statemen, the result is ok.
ex: insert into TABLE2 (kode,ket) values ('001','test'); --> ok.
this is my code:
- Code: Select all Expand view
- #include "fivewin.ch"
func main
local oCon, oRes
oCon := CREATEOBJECT( "ADODB.Connection" )
TRY
oCon:Open( cConnStr )
CATCH
MsgInfo( "Error in Opening connection to Oracle" )
RETURN(.F.)
END TRY
Try
// cSql := "insert into table2 ( select * from table1 where kode='001' )" // result: error
// or
// cSql := "insert into table2 ( select * from table1 )" // result: error
cSql := "insert into TABLE2 (kode,ket) values ('001','test')" // result: ok.
oRes := FW_OpenRecordSet( oCon, cSQL )
if oRes = NIL
msginfo("Error")
endif
Catch
MsgInfo( "Statement error" )
RETURN(.F.)
End Try
return nil
// eof
somebody can help me..?
Mulyadi