Dump in insert statement
<b>INSERT ZTABLE FROM TABLE FINAL</b>.
<b>ZTABLE</b> CONTAINS 9 ENTRIES.
<b>FINAL</b>- INTERNAL TABLE CONTAINS ONLY THE KEY ENTRIES.
I have populated only the key entries (5 entries) in the internal table, I dont want rest of the four entries to get inserted into the ZTABLE.
Thanks in advance,
Vivenchandar R.
hai,
I suppose your internal table has more than one record with the same key,in such case you could use "accepting duplicate keys".
what it does is ,it will insert the vaild entry with the key for the first time,if your internal tavble contains more than one record with the same key ,it will ignore.
START-OF-SELECTION.
wa_test-fileno = '3334'.
wa_test-status ='X'.
APPEND wa_test TO it_test.
INSERT z01test1 FROM TABLE it_test ACCEPTING DUPLICATE KEYS.
IF sy-subrc <> 0.
MESSAGE 'not insterted' TYPE 'I'.
ELSE.
INSERT z01test1 FROM TABLE it_test ACCEPTING DUPLICATE KEYS.
IF sy-subrc <> 0.
MESSAGE 'not insterted2' TYPE 'I'.
ELSE.
MESSAGE 'insterted2' TYPE 'I'.
ENDIF.
try wiht this , hope this will help you
thank you .
Similar Messages
-
Short Dump while INSERTING to a DB Z table
There is one report that we are running in production. Earlier it was taking about 2hrs to run and now it's taking about 14-15 hours to run after we applied the Support Pack. I must agree that the report is not well written by the previous developers and I have been asked to rewrite it but in the meanwhile, they want to continue running the old one.
This report deletes all the existing records first and then updates a Z table. Last week when they tried to run the report as batch job it got cancelled after running 22000 secounds and my basis team told me that logs are getting saturated and we need to use Truncate Statement instead of DELETE from table statement and that is what I did but again when they tried running the report in production it got cancelled again and this time after 55000 secs and this time it's getting cancelled in the last step when we are inserting the records back to the table from the internal table.
So can you please tell me how can I take care of this.
My Findings:
1. Report updates a Z table for 700K records which is really not a very big size.
2. Z table size category is customized for upto 48K to 93K . Does this matter when I try to update 700K records at a time.
3. There is no foreign key relations in the Z table
4. I feel that, it could be a basis problem like, memory related. Any light on this?
5. The program currently uses INSERT statement.Can I try for a success using MODIFY statement. All validations are handled before inserting to remove the duplicates.So I dont see any issues using INSERT statement
6. Can we use a commit statement after INSERT or MODIFY?
7. From SAP help, I see that there is a limitation on the number of records can be inserted or modified. Any idea on the number?
Thanks & Best Regards,
Kiran Babu DasariDump:
Runtime Errors DBIF_RSQL_SQL_ERROR
Exception CX_SY_OPEN_SQL_DB
Date and Time 01/01/2009 10:17:22
Short text
SQL error in the database when accessing a table.
What can you do?
Note which actions and input led to the error.
For further help in handling the problem, contact your SAP administrator
You can use the ABAP dump analysis transaction ST22 to view and manage
termination messages, in particular for long term reference.
How to correct the error
Database error text........: "SQL0964C The transaction log for the database is
full. SQLSTATE=57011 row=1"
Internal call code.........: "[RSQL/INSR/ZTMM_PU_FOR_BW ]"
Please check the entries in the system log (Transaction SM21).
If the error occures in a non-modified SAP program, you may be able to
find an interim solution in an SAP Note.
If you have access to SAP Notes, carry out a search with the following
keywords:
"DBIF_RSQL_SQL_ERROR" "CX_SY_OPEN_SQL_DB"
"ZPMM_BWLOAD_R_V2" or "ZPMM_BWLOAD_INC02"
"FILL_ZTMM_PU_FOR_BW"
If you cannot solve the problem yourself and want to send an error
notification to SAP, include the following information:
1. The description of the current problem (short dump)
To save the description, choose "System->List->Save->Local File
(Unconverted)".
2. Corresponding system log
Display the system log by calling transaction SM21.
Restrict the time interval to 10 minutes before and five minutes
after the short dump. Then choose "System->List->Save->Local File
(Unconverted)".
3. If the problem occurs in a problem of your own or a modified SAP
program: The source code of the program
In the editor, choose "Utilities->More
Utilities->Upload/Download->Download".
4. Details about the conditions under which the error occurred or which
actions and input led to the error.
The exception must either be prevented, caught within proedure
"FILL_ZTMM_PU_FOR_BW" "(FORM)", or its possible occurrence must be declared in
the
RAISING clause of the procedure.
To prevent the exception, note the following:
System environment
SAP-Release 700
Application server... "ucerp13"
Network address...... "192.168.254.23"
Operating system..... "AIX"
Release.............. "5.3"
Hardware type........ "00C4B5BE4C00"
Character length.... 16 Bits
Pointer length....... 64 Bits
Work process number.. 34
Shortdump setting.... "full"
Database server... "ucerp10"
Database type..... "DB6"
Database name..... "RP1"
Database user ID.. "SAPRP1"
Terminal................. " "
Char.set.... "C"
SAP kernel....... 700
created (date)... "Oct 26 2008 20:51:39"
create on........ "AIX 2 5 005DD9CD4C00"
Database version. "DB6_81 "
Patch level. 183
Patch text.. " "
Database............. "DB6 08.02., DB6 09."
SAP database version. 700
Operating system..... "AIX 1 5, AIX 2 5, AIX 3 5, AIX 1 6"
Memory consumption
Roll.... 16192
EM...... 234631488
Heap.... 0
Page.... 24576
MM Used. 28706288
MM Free. 197532304
User and Transaction
Client.............. 400
User................ "BATCHUC"
Language key........ "E"
Transaction......... " "
Transactions ID..... "49597E9619C40076E1008000C0A8FE17"
Program............. "ZPMM_BWLOAD_R_V2"
Screen.............. "SAPMSSY0 1000"
Screen line......... 6
Information on where terminated
Termination occurred in the ABAP program "ZPMM_BWLOAD_R_V2" - in
"FILL_ZTMM_PU_FOR_BW".
The main program was "ZPMM_BWLOAD_R_V2 ".
In the source code you have the termination point in line 2886
of the (Include) program "ZPMM_BWLOAD_INC02".
The program "ZPMM_BWLOAD_R_V2" was started as a background job.
Job Name....... "ZPMM_BWLOAD_R_V2"
Job Initiator.. "BATCHSCHED"
Job Number..... 10261500
The termination is caused because exception "CX_SY_OPEN_SQL_DB" occurred in
procedure "FILL_ZTMM_PU_FOR_BW" "(FORM)", but it was neither handled locally
nor declared
in the RAISING clause of its signature.
The procedure is in program "ZPMM_BWLOAD_R_V2 "; its source code begins in line
2751 of the (Include program "ZPMM_BWLOAD_INC02 ".
Source Code Extract
Line
SourceCde
2856
itab_result-rec_no = recnum.
2857
ENDIF.
2858
2859
11/30/05 - Change it back after sorting
2860
IF linetype = 'AAA'.
2861
itab_result-linetype = 'INI'.
2862
ENDIF.
2863
itab_result-extractdate = e_sdate.
2864
itab_result-mandant = sy-mandt.
2865
MODIFY itab_result INDEX indx.
2866
2867
SELECT SINGLE
2868
rec_no
2869
ponumber
2870
FROM ztmm_pu_for_bw
2871
INTO CORRESPONDING FIELDS OF itab_duprec
2872
WHERE rec_no = recnum
2873
AND ponumber = pono
2874
AND linetype = linetype
2875
AND line_no = lineno
2876
AND changenr = chgno
2877
AND chgind_h = indh
2878
AND chgind_p = indp
2879
AND tblname = tbl
2880
AND fldname = fld.
2881
IF sy-subrc <> 0.
2882
MOVE-CORRESPONDING itab_result TO itab_result_bw.
2883
APPEND itab_result_bw.
2884
nrecs_results = nrecs_results + 1.
2885
>>>>>
INSERT ztmm_pu_for_bw FROM TABLE itab_result_bw.
2887
INSERT zztmm_pu_for_bw FROM TABLE itab_result_bw.
2888
2889
CLEAR itab_result_bw.
2890
REFRESH itab_result_bw.
2891
ENDIF.
2892
ENDLOOP.
2893
*change to array insert for performance
2894
INSERT ZZTMM_PU_FOR_BW FROM TABLE itab_result_bw.
2895
2896
ENDFORM. " fill_ztmm_pu_for_bw
Contents of system fields
Name
Val.
SY-SUBRC
4
SY-INDEX
0
SY-TABIX
1
SY-DBCNT
0
SY-FDPOS
0
SY-LSIND
0
SY-PAGNO
0
SY-LINNO
1
SY-COLNO
1
SY-PFKEY
SY-UCOMM
SY-TITLE
Load Purchasing Info. for BW Reporting
SY-MSGTY
E
SY-MSGID
TD
SY-MSGNO
600
SY-MSGV1
T710-08L04
SY-MSGV2
K01
SY-MSGV3
EN
SY-MSGV4
SY-MODNO
0
SY-DATUM
20081231
SY-UZEIT
190013
SY-XPROG
SAPCNVE
SY-XFORM
CONVERSION_EXIT
Active Calls/Events
No. Ty. Program Include Line
Name
2 FORM ZPMM_BWLOAD_R_V2 ZPMM_BWLOAD_INC02 2886
FILL_ZTMM_PU_FOR_BW
1 EVENT ZPMM_BWLOAD_R_V2 ZPMM_BWLOAD_R_V2 192
START-OF-SELECTION
Chosen variables
Name
Val.
No. 2 Ty. FORM
Name FILL_ZTMM_PU_FOR_BW
SY
#######ৡ###################A###P#################ż#############################T#######린 u#̀##
00000000000000000000000000000000000000010000000000000000000000000000000000000000000000FB000000
000000090000000000000000000000000000000A0000000001000000000000000000000000000000000000F9000300
0000000E0000000000000000000400050000000B0000000007000000000000000000000000000105000000FB270000
0000010100000000000000000101010000000000000000040C000000000000000000000000000604000000F005000C
ITAB_RESULT_BW-WAERS
USD
00000
00000
55422
53400
ITAB_RESULT-WAERS
USD
00000
00000
55422
53400
ITAB_RESULT_BW+5358(10)
#U#C# #
0205040202
0005030000
ITAB_RESULT+4160(10)
#U#C# #
0205040202
0005030000
AMTCRCHGPOSREGUA2
00000000000
0000000000C
ITAB_RESULT_BW+5378(572)
#S#h#i#p#p#i#n#g# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
0205060607070606060202020202020202020202020202020202020202020202020202020202020202020202020202
000308090000090E070000000000000000000000000000000000000000000000000000000000000000000000000000
ITAB_RESULT+4170(572)
#S#h#i#p#p#i#n#g# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
0205060607070606060202020202020202020202020202020202020202020202020202020202020202020202020202
000308090000090E070000000000000000000000000000000000000000000000000000000000000000000000000000
C_INITIAL
@0E@
000000
000000
434422
005000
ITAB_RESULT_BW-ORT01
Cincinnati
00000000000000000000000000000000000
00000000000000000000000000000000000
46666666762222222222222222222222222
39E39EE1490000000000000000000000000
ITAB_RESULT-ORT01
Cincinnati
00000000000000000000000000000000000
00000000000000000000000000000000000
46666666762222222222222222222222222
39E39EE1490000000000000000000000000
ITAB_RESULT_BW-PSTLZ
45206
0000000000
0000000000
3333322222
4520600000
ITAB_RESULT-PSTLZ
45206
0000000000
0000000000
3333322222
4520600000
ITAB_RESULT_BW-REGIO
OH
000
000
442
F80
ITAB_RESULT-REGIO
OH
000
000
442
F80
ITAB_RESULT_BW-STRAS
2709 Woodburn Ave.
00000000000000000000000000000000000
00000000000000000000000000000000000
33332566667762476222222222222222222
270907FF4252E0165E00000000000000000
ITAB_RESULT-STRAS
2709 Woodburn Ave.
00000000000000000000000000000000000
00000000000000000000000000000000000
33332566667762476222222222222222222
270907FF4252E0165E00000000000000000
%_SPACE
0
0
2
0
ITAB_RESULT_BW+6154(4)
0202
0000
ITAB_RESULT+4908(4)
0202
0000
LW_LINES
164
000A
0004
ITAB_RESULT_BW-TELF1
961-1122
0000000000000000
0000000000000000
3332333322222222
961D112200000000
ITAB_RESULT-TELF1
961-1122
0000000000000000
0000000000000000
3332333322222222
961D112200000000
ITAB_RESULT_BW-LAND1
US
000
000
552
530
ITAB_RESULT-LAND1
US
000
000
552
530
COUNTROCHGNEGCONOVER1K2
0
0000
0000
ITAB_RESULT_BW+6158(337)
#0#3#6#0#-#0#0# # # # # # # # # # # # # #M#R#O# #&# #C#o#n#s#t#r#u#c#t#i#o#n#A#t#h#l#e#t#i#c
0203030303020303020202020202020202020202020405040202020406060707070706070606060407060606070606
00000306000D0000000000000000000000000000000D020F000600030F0E030402050304090F0E0104080C05040903
ITAB_RESULT+4950(337)
#0#3#6#0#-#0#0# # # # # # # # # # # # # #M#R#O# #&# #C#o#n#s#t#r#u#c#t#i#o#n#A#t#h#l#e#t#i#c
0203030303020303020202020202020202020202020405040202020406060707070706070606060407060606070606
00000306000D0000000000000000000000000000000D020F000600030F0E030402050304090F0E0104080C05040903
ITAB_CHGLOG[]
Table IT_33[587x1576]
\PROGRAM=ZPMM_BWLOAD_R_V2\DATA=ITAB_CHGLOG[]
Table reference: 25
TABH+ 0(20) = 070000009070DB38000000000000000000000000
TABH+ 20(20) = 00000019000000210000024B00000628FFFFFFFF
TABH+ 40(16) = 040000000000149000082C9401800000
store = 0x070000009070DB38
ext1 = 0x0000000000000000
shmId = 0 (0x00000000)
id = 25 (0x00000019)
label = 33 (0x00000021)
fill = 587 (0x0000024B)
leng = 1576 (0x00000628)
loop = -1 (0xFFFFFFFF)
xtyp = TYPE#000095
occu = 8 (0x00000008)
access = 1 (ItAccessStandard)
idxKind = 1 (ItIndexLinear)
uniKind = 2 (ItUniqueNon)
keyKind = 1 (default)
cmpMode = 2 (cmpSingleMcmpR)
occu0 = 1
groupCntl = 0
rfc = 0
unShareable = 0
mightBeShared = 0
sharedWithShmTab = 0
isShmLockId = 0
gcKind = 0
isUsed = 1
isCtfyAble = 1
>>>>> Shareable Table Header Data <<<<<
tabi = 0x07000000A0E13E70
pgHook = 0x07000000B2EBC728
idxPtr = 0x07000000906BA5E0
shmTabhSet = 0x0000000000000000
id = 32 (0x00000020)
refCount = 0 (0x00000000)
tstRefCount = 0 (0x00000000)
lineAdmin = 1024 (0x00000400)
lineAlloc = 592 (0x00000250)
shmVersId = 0 (0x00000000)
shmRefCount = 469 (0x000001D5)
>>>>> 1st level extension part <<<<<
regHook = Not allocated
collHook = Not allocated
ext2 = Not allocated
>>>>> 2nd level extension part <<<<<
tabhBack = Not allocated
delta_head = Not allocated
pb_func = Not allocated
pb_handle = Not allocated
ITAB_RESULT_BW+3592(1026)
0202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
ITAB_RESULT+5798(1026)
0202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
ITAB_RESULT_BW-MANDANT
400
000
000
333
400
ITAB_RESULT-MANDANT
400
000
000
333
400
AMTTCCHGPOSREGST2
00000000000
0000000000C
ITAB_RESULT_BW[]
Table IT_132[1x6760]
\PROGRAM=ZPMM_BWLOAD_R_V2\DATA=ITAB_RESULT_BW[]
Table reference: 51
TABH+ 0(20) = 07000000A9A1FEA8000000000000000000000000
TABH+ 20(20) = 00000033000000840000000100001A68FFFFFFFF
TABH+ 40(16) = 0400000000003140000224C401800000
store = 0x07000000A9A1FEA8
ext1 = 0x0000000000000000
shmId = 0 (0x00000000)
id = 51 (0x00000033)
label = 132 (0x00000084)
fill = 1 (0x00000001)
leng = 6760 (0x00001A68)
loop = -1 (0xFFFFFFFF)
xtyp = TYPE#000248
occu = 2 (0x00000002)
access = 1 (ItAccessStandard)
idxKind = 0 (ItIndexNone)
uniKind = 2 (ItUniqueNon)
keyKind = 1 (default)
cmpMode = 8 (cmpManyEq)
occu0 = 1
groupCntl = 0
rfc = 0
unShareable = 0
mightBeShared = 0
sharedWithShmTab = 0
isShmLockId = 0
gcKind = 0
isUsed = 1
isCtfyAble = 1
>>>>> Shareable Table Header Data <<<<<
tabi = 0x07000000A283E980
pgHook = 0x0000000000000000
idxPtr = 0x0000000000000000
shmTabhSet = 0x0000000000000000
id = 141 (0x0000008D)
refCount = 0 (0x00000000)
tstRefCount = 0 (0x00000000)
lineAdmin = 2 (0x00000002)
lineAlloc = 2 (0x00000002)
shmVersId = 0 (0x00000000)
shmRefCount = 1 (0x00000001)
>>>>> 1st level extension part <<<<<
regHook = Not allocated
collHook = Not allocated
ext2 = Not allocated
>>>>> 2nd level extension part <<<<<
tabhBack = Not allocated
delta_head = Not allocated
pb_func = Not allocated
pb_handle = Not allocated
ITAB_RESULT_BW
400##͒4500034945
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
3330053333333333222222222222222222222222222222222222222222222222222222222222222222222222222222
4000024500034945000000000000000000000000000000000000000000000000000000000000000000000000000000
%_DUMMY$$
0000
0000
2222
0000
COUNTTCCHGNEGCONST3
0
0000
0000
<%_TABLE_ZTMM_PU_FOR_BW>
AMTTOTAL3
00000000000
0000000000C
No. 1 Ty. EVENT
Name START-OF-SELECTION
T023T
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
T024
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
T161
00000 00000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
2222222223333322222222222222222222222222222222222333332222222222222222222222222222222222222222
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
TWLAD
000000000000000000000000
000000000000000000000000
222222222222222222222222
000000000000000000000000
ZTMM_BOA
0000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
2222222222222223333333333333333222222222222222222222222222222222222222222222222222222222222222
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
ZTMM_PU_FOR_BW
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
2220002222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
ZTPU_DOCTYPE
0000000000000000000000000000000000
0000000000000000000000000000000000
2222222222222222222222222222222222
0000000000000000000000000000000000
USR02
####0000000000000000 # 000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
2222222222222220000333333333333333322222222222220222222222222222222222222333333333333333333333
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
SSCRFIELDS
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
C_BLUESQUAREX
@3X@
000000
000000
435422
038000
Internal notes
The termination was triggered in function "HandleRsqlErrors"
of the SAP kernel, in line 786 of the module
"//bas/700_REL/src/krn/runt/absapsql.c#11".
The internal operation just processed is "SQLS".
Internal mode was started at 20081231190002.
Internal call code.........: "[RSQL/INSR/ZTMM_PU_FOR_BW ]"
Active Calls in SAP Kernel
Lines of C Stack in Kernel (Structure Differs on Each Platform)
=> 64 bit R/3 Kernel
=> 64 bit AIX Kernel
=> Heap limit = unlimited
=> Stack limit = 4294967296
=> Core limit = 1073741312
=> File size limit = unlimited
=> Heap address = 0x0x11c0f5d60
=> Stack address = 0xfffffffffff8040
=> Stack low = 0xfffffffffff8040
=> Stack high = 0xffffffffffff800
=> Stack Trace:
AixStack() at 0x1000c945c
CTrcStack2() at 0x1000c9554
rabax_CStackSave__Fv() at 0x1000b3ee0
ab_rabax() at 0x1000b0628
ab_rsqlerr__FPCUsiT1P11RS_HEADER94T1Pv() at 0x10058c010
HandleRsqlErrors__F9RsqlError9CloseMode() at 0x1017f1e94
SqlsExecuteCall__FUcP11DynCallInfo() at 0x1017efc68
ab_jsqls__Fv() at 0x1017ea82c
ab_extri__Fv() at 0x100419ca0
ab_xevent__FPCUs() at 0x10094e47c
ab_trigg__Fv() at 0x10094e168
ab_run() at 0x1011aabb8
N_ab_run() at 0x100f6edc0
dynpmcal() at 0x100f6d9c4
dynppai0() at 0x100f6b2c8
dynprctl() at 0x100f7375c
dynpen00() at 0x100f6761c
Thdynpen00() at 0x1000e3c6c
TskhLoop() at 0x1000e5b64
ThStart() at 0x1001000c0
DpMain() at 0x101301d34
nlsui_main() at 0x101abea68
List of ABAP programs affected
Index
Typ
Program
Group
Date
Time
Size
Lang.
0
Prg
ZPMM_BWLOAD_R_V2
0
12/31/2008
10:10:08
409600
E
1
Prg
SAPMSSY0
1
05/30/2008
12:59:05
92160
E
2
Prg
SAPMSSYD
1
08/16/2006
12:06:37
21504
E
3
Prg
SAPFSYSCALLS
1
09/09/2004
14:18:32
7168
E
4
Prg
RSDBRUNT
0
12/13/2008
02:15:03
254976
E
5
Prg
SAPLSPRI
5
12/13/2008
02:14:06
342016
E
6
Typ
PRI_PARAMS
0
11/02/1998
09:46:12
5120
7
Typ
ARC_PARAMS
0
08/28/1997
08:36:28
6144
8
Typ
PRI_LAYOUT
0
11/06/2003
20:30:04
2048
9
Typ
PRIPAR_EXT
0
05/18/2004
14:07:03
3072
10
Typ
PRIPAR_EX2
0
11/09/2000
14:10:39
2048
11
Typ
PRIPAR_EX3
0
05/18/2004
14:07:03
5120
12
Typ
TPRI_DEF
0
11/09/2000
14:24:28
5120
13
Typ
USR01
0
05/30/2008
19:06:47
4096
14
Typ
TSP1D
0
11/15/2000
17:58:02
5120
15
Prg
SAPLSPOO
15
12/13/2008
02:14:06
160768
E
16
Prg
SAPLRSPOLSTDRV
16
12/13/2008
02:13:54
58368
E
17
Typ
TSPOPTIONS
0
01/29/1997
19:13:56
2048
18
Typ
TSP03
0
11/02/1998
09:57:05
5120
19
Typ
TSP0A
0
11/15/2000
17:58:02
6144
20
Typ
TSP03C
0
11/21/2003
11:41:10
7168
21
Typ
TSP03T
0
03/23/1998
18:21:38
6144
22
Typ
TSP06A
0
11/15/2000
17:58:02
7168
23
Prg
SAPCNVE
23
09/09/2004
14:36:10
8192
E
24
Prg
SAPLSPOC
24
12/13/2008
02:15:07
137216
E
25
Typ
TSP03L
0
07/10/1997
00:46:18
2048
26
Typ
RSPOCHECK
0
08/13/1997
12:53:10
4096
27
Typ
TSP03A
0
07/10/1997
00:46:15
3072
28
Prg
SAPLSPOR
28
12/13/2008
02:15:07
39936
E
29
Prg
SAPLSPOB
29
05/30/2008
09:36:14
67584
E
30
Prg
SAPLSDEX
30
09/09/2004
14:20:42
22528
E
31
Typ
DD07T
0
05/30/2008
00:38:18
3072
32
Typ
DEVPAR
0
12/04/2000
12:46:11
3072
33
Typ
RSPOATTR
0
11/10/1999
17:44:19
2048
34
Typ
RSSCR
0
03/30/2005
10:21:45
5120
35
Prg
RSDBSPBL
0
03/30/2005
10:21:58
72704
E
36
Prg
SAPDB__S
0
03/30/2005
10:22:01
19456
E
37
Typ
VARID
0
05/12/1997
16:51:30
4096
38
Typ
SSCRFIELDS
0
05/13/1997
12:54:26
5120
39
Prg
%_CSYDB0
0
03/30/2005
10:21:45
35840
E
40
Prg
RSDBSPVA
0
12/13/2008
02:15:03
133120
E
41
Typ
RSVAMEMKEY
0
05/07/1997
13:07:49
5120
42
Prg
RSDBSPMC
0
08/16/2006
11:55:58
79872
E
43
Typ
DDSHDESCR
0
09/03/1997
03:05:16
4096
44
Typ
SPPARAMS
0
05/07/1997
13:10:38
2048
45
Prg
SAPLICON
45
05/30/2008
13:22:44
27648
E
46
Prg
%_CICON
45
05/30/2008
13:22:44
107520
E
47
Typ
ICONT
0
08/16/2006
11:55:57
2048
48
Prg
SAPLSABE
48
09/09/2004
14:18:36
12288
E
49
Prg
SAPLSECU
49
05/30/2008
11:07:13
87040
E
50
Typ
RSSUBINFO
0
10/14/1999
22:01:03
2048
51
Typ
RSEXFCODE
0
08/13/1997
12:52:57
2048
52
Prg
SAPLDSYA
52
05/30/2008
12:53:05
45056
E
53
Prg
SAPFSDS1
52
03/30/2005
10:22:01
52224
E
54
Typ
TDCLD
0
11/02/1998
09:51:35
6144
55
Prg
SAPLSDOD
55
01/25/2006
10:59:45
45056
E
56
Typ
DOKIL
0
05/12/1997
16:46:17
3072
57
Prg
SAPLLANG
57
09/09/2004
14:18:35
10240
E
58
Typ
T002
0
05/30/2008
00:53:58
2048
59
Prg
SAPFSPOR
0 -
Problem With Insert statement using field symbols with unicode enabled
I was writng a function module for dyanamic operations on the table. We are using the field symbols, function module is unicode enabled.
Assign statements are working fine, with which we created work are <fs_wa_header> and internal table <fs_tb_item> dynamically based on the table name (IM_TB_HENAME) which we get as import parameter.
we have query which is giving us dump.
INSERT (IM_TB_HENAME) FROM <FS_WA_HEADER>.Hi
INSERT (IM_TB_HENAME) FROM <FS_WA_HEADER> is good for inserting a line in the database, so IM_TB_HENAME has to have the name of dictionary table.
U should write:
INSERT <FS_WA_HEADER> INTO (IM_TB_HENAME).
But I believe you can't use the variable IM_TB_HENAME, you should use another field-symbols:
ASSIGN (IM_TB_HNAME) TO <FS_TB_ITEM>.
INSERT <FS_WA_HEADER> INTO <FS_TB_ITEM>.
Max -
Short dump while inserting into PA0008
Hi Gurus,
I am trying to use a transfer tool to import employee details from one system to another.
All infotypes are being imported properly but the table PA0008 is not getting imported and
it gives short dump when the program reaches the statement :
"INSERT (AKT-TABLE) FROM W_PREL."
The dump is shown as "DBIF_RSQL_INVALID_REQUEST".The reason are not clear.
Any hints please ?
Waiting for responses,
Sandip.Hi
How you are inserting data into PA0008?
You can use HR_INFOTYPE_CREATION fun module to insert data .
See the dump completely in ST22 tcode and analyse it
always better to use MODIFY statement instead of INSERT statement to insert the data into tables/infotypes.
do like that, and check the Dump.
Regards
Anji -
hi,
we are trying to insert values into data base table using insert statement.but we are unable to do it with normal insert statement is there any other way to do this if so please suggest us.and pleae tell us why the normal insert statement is not working.What exactly is not working? Do you get a short dump or some sort of message? If you try and insert a record that is already present in the table, than this would result in an error.
Please add some additional info about your error / statement you are using for insert.
Kind regards,
Micky. -
ABAP Program Giving SAPSQL_ARRAY_INSERT_DUPREC Dump While Inserting Entries
Hi Experts,
I had z table in which i had made three fields as primary key combination , i also had a custom program in which i am inserting values into the z table using Insert statement. during the execution of the program it is going for a short dump giving "SAPSQL_ARRAY_INSERT_DUPREC" With Exception CX_SY_OPEN_SQL_DB.
The Delivery Class of the Table is "C".
The thing is that i want if 1st field is "ORG ID" second Field is "Material" & the third field is "Type Id". then the system should allow entries like
ORG ID
Material Id
Type Id
|"0001" | "100'' | "R1" |
"0001"
"100''
"R2"
|"0001" | "100'' | "R3" |
"0001"
"100''
"R4"
Is there any OSS note for Corrections.
Thanks & regards
Priyesh Shah.Hi
Are you sure your table has those 3 fields as key fields?
I means you make sure the fields: ORG ID, Material Id, Type Id are key fields.
If you are sure the internal table has not duplicated records and your z-table is empty: It can only suppose some field is not a key.
If you have made some modification, try to check the database defination of your z-table is equal to dictionary defination
Max -
Hi...
I want to make an insert statement with a cursor, and if in the destination table exists allready a record like in start table, I would like to skip to insert that record.....and inserting the other records from the start table......
Can anyone help me?
Thanks.Why not a plain insert statement like this
insert into dest_table (col1, col2)
select col3, col4
from source_table
where not exists(select 1 from dest_table where col1=col4); -
Insert statement in when-checkbox-checked trigger doesn't work
in a when-checkbox-checked trigger, I wrote the follwing code :
IF :sunday = 'Y' THEN
msg_alert('Y','I',false);
pkg_var.v_day_count := pkg_var.v_day_count + 1;
msg_alert('1','I',false);
:schtm_skmk.day_id := '1';
msg_alert('2 ',I',false);
INSERT INTO schtm
(ROUTE_ID, DAY_ID, FLIGHT_ID)
VALUES
(:schmf.ROUTE_ID, :schtm_skmk.day_id, 1);
COMMIT;
msg_alert('end insert schtm','I',false);
END IF;
if the checkbox is checked, I assigned value '1' to day_id. Then, I want to insert a row into table SCHTM. But, the insert statement fail. The msg_alert '2' pop up. The msg_alert 'end insert schtm' does not pop up, meaning the insert statement fail. It also fail after I replace the insert statement with the exact value of the item. But if I execute this statement in SQL plus, it insert a row into the database.
What is strange here is it did work before, I successfully insert 2 rows into database. But when I test it again just a while later, it never work anymore.
Please help.
Thanks,
Shu WenIt seems that you have missed ELSE. By the way there is only one INSERT ...
-
Urgent help needed... PL/SQL Insert statement
Hi...
I need some urgent help on this project. I have a 2 column table with values that need to be inserted into another existing table which has a sequence.
This is the 2 column table:
FUND YEAR
29587 05
29587 07
Existing table:
Name Null? Type
LIST_ID NOT NULL NUMBER(6) -- This is a sequence
WEB_USER_ID NOT NULL VARCHAR2(10)
RESOURCE_TYPE NOT NULL VARCHAR2(8)
LIST_TYPE NOT NULL VARCHAR2(10)
LIST_NAME NOT NULL VARCHAR2(50)
LIST_CODE_1 NOT NULL VARCHAR2(6) -- FUND from table above
LIST_CODE_2 NOT NULL VARCHAR2(6) -- YEAR from table above
LIST_CODE_3 NOT NULL VARCHAR2(6)
LAST_UPDATED_DT NOT NULL DATE
LAST_UPDATED_BY NOT NULL VARCHAR2(10)
LIST_CODE_4 NOT NULL VARCHAR2(20)
The columns from table 1 (FUND, YEAR) correspond to columns (LIST_CODE_1, LIST_CODE_2) in table 2. The column LIST_ID is a sequence. I can put in sysdate for LAST_UPDATED_DT and my initials SN for LAST_UPDATED_BY. This is going to be for 2 unique WEB_USER_IDs which would be in the WHERE clause. I will be inserting 2200 rows for each id. A single insert statement would look like this -
INSERT INTO EXISTING_TBL (list_id,web_user_id,resource_type,list_type,list_name,list_code_1,list_code_2,list_code_3,list_code_4,last_updated_dt,last_updated_by) VALUES ('470027','WEBUSER','GL','FUNDFYF',' FUND BALANCE SUM','12010','01',' ',' ',{ts '2010-5-19 10:16:9'},'SN')
How would I do this to insert the 2200 values from my 2 column table to the existing table?
All help is greatly appreciated!!
SNHello ,
I think this will work
INSERT INTO TABLE2
LIST_ID,
WEB_USER_ID,
RESOURCE_TYPE,
LIST_TYPE,
LIST_NAME,
LIST_CODE_1,
LIST_CODE_2,
LIST_CODE_3,
LIST_CODE_4,
LAST_UPDATED_DT,
LAST_UPDATED_BY
SELECT
SEQ.NEXTVAL,
FUND,
YEAR,
<VALUE FOR RESOURCE_TYPE>,
<VALUE FOR LIST_TYPE>,
<VALUE FOR LIST_NAME>,
<VALUE FOR LIST_CODE_1>,
<VALUE FOR LIST_CODE_2>,
<VALUE FOR LIST_CODE_3>,
<VALUE FOR LIST_CODE_4>,
SYSDATE,
'SN'
FROM
TABLE1
REGARDS
Rahul Sharma -
Insert Statement Will Not Work if a user has
I am using a MySQL database to process my Java Server Page form.
Simply, I always try to see if I can process information, first, via the command line client, then thru JSP.
At the command line client I type:
I type insert into tablename (favorite_quote) VALUES
('Sleepin' in 'da house!');
That insert throws an error. SImply said, because of the bunches of single quotes... Is there any advanced statement or insert statement to solve this?
If I do this:
INSERT INTO tablename (favorite_quote) VALUES
('Java');
It adds the record perfectly normal...
I am REALLY new to Java, so any help on this issue would be great!
BTW: Part of my Java Server Pages has:
String favorite_quote =request.getParameter("favorite_quote");
"INSERT INTO tablename (favorite_quote) VALUES " +
"('"+userid+"')";
Obviously that works fine unless anybody adds a ' or " isn't or what's, etc.
I'm loving Java, I just REALLY need some help on solving this issue.
Thank you so much! Any help would BE **WONDERFUL**!String favorite_quote
te =request.getParameter("favorite_quote");
PreparedStatement ps =
= connection.prepareStatement(""INSERT INTO tablename
(favorite_quote) VALUES (?)");
ps.setString(1, "Sleepin' in 'da house!");
ps.execute();oops a small error
PreparedStatement ps = connection.prepareStatement("INSERT INTO tablename (favorite_quote) VALUES (?)"); -
Insert statement does not insert all records from a partitioned table
Hi
I need to insert records in to a table from a partitioned table.I set up a job and to my surprise i found that the insert statement is not inserting all the records on the partitioned table.
for example when i am using select statement on to a partitioned table
it gives me 400 records but when i insert it gives me only 100 records.
can anyone help in this matter.INSERT INTO TABLENAME(COLUMNS)
(SELECT *
FROM SCHEMA1.TABLENAME1
JOIN SCHEMA2.TABLENAME2a
ON CONDITION
JOIN SCHEMA2.TABLENAME2 b
ON CONDITION AND CONDITION
WHERE CONDITION
AND CONDITION
AND CONDITION
AND CONDITION
AND (CONDITION
HAVING SUM(COLUMN) > 0
GROUP BY COLUMNS -
Using the Insert statement in a Java program without hardcoding the data
hello.
this is james mcfadden. i have developed a program called Demo.java, which is used with another program called QueryTableModel.java (a program that allows data to be viewed in a JTable). The Demo.java program displays a menu, connects to a database, allows the user to add data into the database and allows the user to view data that is already in the database. I have a problem with the Demo.java program. I have hardcoded the Insert statement in it. How do you use the Insert statement to put data into a database without hardcoding the data?
import java.awt.*;//Contains all of the classes for creating user interfaces and for painting graphics and images
import java.awt.event.*;//Provides interfaces and classes for dealing with different types of events fired by AWT components
import javax.swing.*;//Provides a set of lightweight components that, to the maximum degree possible, work the same on all platforms
import javax.swing.table.*;//Provides classes and interfaces for dealing with javax.swing.JTable
import javax.swing.JOptionPane;//provides a class that makes it easy to pop up a standard dialog box that prompts users for a value or informs them of something
import java.sql.*;//Provides the API for accessing and processing data stored in a data source using the Java programming language
public class Demo extends JFrame{
static String url = "jdbc:odbc:VideoLibrary";//a static variable that allows a connection to be made to a database called VideoLibrary
static Statement stmt;//a static variable that allows a statement to be made once a connection is set up
static Connection con;//a static interface that allows a connection to be made to a database
//global variables
JTextField hostField;//a class that allows a line of text to be changed
JTextField queryField;//a class that allows a line of text to be changed
QueryTableModel qtm;//a class that shows and changes regular two-dimensional tables of cells
JComboBox comboBox;//a class that puts a button or editable field and a drop-down list together
public static void main(String args[]){
int choice=-1;//a variable of type int that is set to -1
do{
choice=getChoice();//invokes the method getChoice()
if(choice!=0){
getSelected(choice);//invokes the method getSelected(choice)
}//end if
//if the user chooses 5, it will cause him or her to exit the system
}while(choice!=5);//end do-while
System.exit(0);//closes down the menu screen
}//end main
public static int getChoice(){
String choice;//a variable of type string
int ch;//a variable of type int
choice = JOptionPane.showInputDialog(null,"1. Maintain product details\n"+"2. Maintain member details\n"+"3. Maintain rental details\n"+"4. View product, member and rental details\n"+"5. Log Off\n\n"+"Enter your choice");//asks the user for some input
ch = Integer.parseInt(choice);//a class that wraps a value of the primitive type int in an object
return ch;//a method that returns an integer value
}//end getChoice
public static void getSelected(int choice){
if(choice==1){
maintainProductDetails();//invokes the method maintainProductDetails()
}//end if
if(choice==2){
maintainMemberDetails();//invokes the method maintainMemberDetails()
}//end if
if(choice==3){
maintainRentalDetails();//invokes the method maintainRentalDetails()
}//end if
if(choice==4){
Demo test = new Demo();//invokes the constructor Demo()
test.setVisible(true);//shows the JTable component by marking it as visible
}//end if
}//end getSelected
public static Connection getConnection(){
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");//used to create a JDBC connection using a database
}//end try
catch(java.lang.ClassNotFoundException e){//causes an exception to be thrown when an application tries to load in a class through its string name
System.err.print("ClassNotFoundException: ");//displays an error message
System.err.println(e.getMessage());//returns the exception that was raised if an error occurred while attempting to load the ClassNotFoundException class
}//end catch
try {
con=DriverManager.getConnection(url,"","");//tries to create a connection with the database using the DriverManager class
}//end try
catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());//returns an SQL error message
}//end catch
return con;
}//end getConnection
public static void maintainProductDetails(){
Connection con = getConnection();//creates a connection with the database
String addProduct1, addProduct2, addProduct3, addProduct4, addProduct5, addProduct6, addProduct7, addProduct8, addProduct9, addProduct10;//string variables that represent information about the different types of product data that will be stored in the database
addProduct1 = "insert into Product values (110001, 'The Killers - Sams Town', 5.00, 'G', 'CD', 2006)";
addProduct2 = "insert into Product values (110002, 'Robbie Williams - Rudebox', 5.00, 'G', 'CD', 2006)";
addProduct3 = "insert into Product values (110003, 'Razorlight - Razorlight', 5.00, 'G', 'CD', 2006)";
addProduct4 = "insert into Product values (110004, 'My Chemical Romance - The Black Parade', 5.00, 'G', 'CD', 2006)";
addProduct5 = "insert into Product values (110005, 'Snow Patrol - Eyes Open', 5.00, 'G', 'CD', 2006)";
addProduct6 = "insert into Product values (110006, 'Scissor Sisters - Ta-Dah!', 5.00, 'G', 'CD', 2006)";
addProduct7 = "insert into Product values (110007, 'Lovesounds - Justin Timberlake', 5.00, 'G', 'CD', 2006)";
addProduct8 = "insert into Product values (110008, 'Director - We thrive on big cities', 5.00, 'G', 'CD', 2006)";
addProduct9 = "insert into Product values (110009, 'Roxette - Roxette hits', 5.00, 'G', 'CD', 2006)";
addProduct10 = "insert into Product values (110010, 'Pussy Cat Dolls - PCD', 5.00, 'G', 'CD', 2006)";
try {
stmt = con.createStatement();//Creates a Statement object for sending SQL statements to the database
//statements are allowed to be made once a connection is set up
stmt.executeUpdate(addProduct1);
stmt.executeUpdate(addProduct2);
stmt.executeUpdate(addProduct3);
stmt.executeUpdate(addProduct4);
stmt.executeUpdate(addProduct5);
stmt.executeUpdate(addProduct6);
stmt.executeUpdate(addProduct7);
stmt.executeUpdate(addProduct8);
stmt.executeUpdate(addProduct9);
stmt.executeUpdate(addProduct10);
stmt.close();//closes the Statement object
con.close();//terminates the connection with the database
}//end try
catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());//returns an SQL error message
}//end catch
}//end maintainProductDetails
public static void maintainMemberDetails(){
Connection con = getConnection();//creates a connection with the database
String addMember1, addMember2, addMember3, addMember4, addMember5, addMember6, addMember7, addMember8, addMember9, addMember10;//string variables that represent information about the member data that will be stored in the database
addMember1 = "insert into Member values (1234, 'Ann', 'Smyth', 'Upper Killult, Falcarragh, Co. Donegal', '(074)-9135210', '(087)-2030172', #5/11/85#, #5/12/06#)";
addMember2 = "insert into Member values (2345, 'John', 'Murphy', 'Lower Killult, Falcarragh, Co. Donegal', '(074)-9135211', '(087)-2030173', #4/12/85#, #6/13/06#)";
addMember3 = "insert into Member values (1324, 'James', 'McFadden', 'Lower Ardsbeg, Gortahork, Co. Donegal', '(074)-9165314', '(087)-2030171', #4/11/85#, #6/14/06#)";
addMember4 = "insert into Member values (1235, 'Frankie', 'Ferry', 'Ardsmore, Gortahork, Co. Donegal', '(074)-9165325', '(087)-2031234', #6/13/60#, #6/15/06#)";
addMember5 = "insert into Member values (1236, 'Daniel', 'McKimm', 'Ballyness, Falcarragh, Co. Donegal', '(074)-9135212', '(087)-2030184', #5/14/73#, #6/16/06#)";
addMember6 = "insert into Member values (2346, 'Stephen', 'Doohan', 'Ballyness, Falcarragh, Co. Donegal', '(074)-9135213', '(087)-2030185', #6/13/85#, #5/13/06#)";
addMember7 = "insert into Member values (2347, 'James', 'Ferry', 'Meenlaragh, Gortahork, Co.Donegal', '(074)-9165360', '(087)-2031345', #9/12/85#, #5/14/06#)";
addMember8 = "insert into Member values (2348, 'Liam', 'Cannon', 'Derryconner, Gortahork, Co.Donegal', '(074)-9165324', '(087)-2031456', #4/11/86#, #5/15/06#)";
addMember9 = "insert into Member values (2401, 'Ciaran', 'Ferry', 'Brinalack, Gweedore, Co.Donegal', '(074)-9176425', '(087)-2030282', #9/12/85#, #5/16/06#)";
addMember10 = "insert into Member values (2402, 'Ciaran', 'McGee', 'Derrybeg, Gweedore, Co.Donegal', '(074)-9176536', '(087)-2030393', #9/14/85#, #5/18/06#)";
try{
stmt = con.createStatement();//Creates a Statement object for sending SQL statements to the database
//statements are allowed to be made once a connection is set up
stmt.executeUpdate(addMember1);
stmt.executeUpdate(addMember2);
stmt.executeUpdate(addMember3);
stmt.executeUpdate(addMember4);
stmt.executeUpdate(addMember5);
stmt.executeUpdate(addMember6);
stmt.executeUpdate(addMember7);
stmt.executeUpdate(addMember8);
stmt.executeUpdate(addMember9);
stmt.executeUpdate(addMember10);
stmt.close();//closes the Statement object
con.close();//terminates the connection with the database
}//end try
catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());//returns an SQL error message
}//end catch
}//end maintainMemberDetails
public static void maintainRentalDetails(){
Connection con = getConnection();//creates a connection with the database
String addRental1, addRental2, addRental3, addRental4, addRental5, addRental6, addRental7, addRental8, addRental9, addRental10;//string variables that represent information about the loan data that will be stored in the database
addRental1 = "insert into Rental values (110001, 'The Killers - Sams Town', 1234, 'Ann', 'Smyth', #9/01/06#, #9/10/06#, 'Yes', 2.00)";
addRental2 = "insert into Rental values (120001, 'Mission Impossible 3', 2345, 'John', 'Murphy', #9/02/06#, #9/09/06#, 'No', 0.00)";
addRental3 = "insert into Rental values (130001, 'Need for Special Carbon', 1324, 'James', 'McFadden', #9/03/06#, #9/12/06#, 'Yes', 2.00)";
addRental4 = "insert into Rental values (110002, 'Robbie Williams - Rudebox', 1235, 'Frankie', 'Ferry', #9/04/06#, #9/11/06#, 'No', 0.00)";
addRental5 = "insert into Rental values (120015, 'Prime', 1236, 'Daniel', 'McKimm', #9/05/06#, #9/14/06#, 'Yes', 2.00)";
addRental6 = "insert into Rental values (130015, 'FIFA 07', 2346, 'Stephen', 'Doohan', #9/06/06#, #9/13/06#, 'No', 0.00)";
addRental7 = "insert into Rental values (110009, 'Roxette - Roxette hits', 2347, 'James', 'Ferry', #9/07/06#, #9/16/06#, 'Yes', 2.00)";
addRental8 = "insert into Rental values (120003, 'The Break Up', 2348, 'Liam', 'Cannon', #9/08/06#, #9/15/06#, 'No', 0.00)";
addRental9 = "insert into Rental values (130027, 'Gears of War', 2401, 'Ciaran', 'Ferry', #9/09/06#, #9/18/06#, 'Yes', 2.00)";
addRental10 = "insert into Rental values (110021, 'Scooter - Mind the Gap', 2402, 'Ciaran', 'McGee', #9/10/06#, #9/17/06#, 'No', 0.00)";
try{
stmt = con.createStatement();//Creates a Statement object for sending SQL statements to the database
//statements are allowed to be made once a connection is set up
stmt.executeUpdate(addRental1);
stmt.executeUpdate(addRental2);
stmt.executeUpdate(addRental3);
stmt.executeUpdate(addRental4);
stmt.executeUpdate(addRental5);
stmt.executeUpdate(addRental6);
stmt.executeUpdate(addRental7);
stmt.executeUpdate(addRental8);
stmt.executeUpdate(addRental9);
stmt.executeUpdate(addRental10);
stmt.close();//closes the Statement object
con.close();//terminates the connection with the database
}//end try
catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());//returns an SQL error message
}//end catch
}//end maintainRentalDetails
public Demo(){//a constructor
super("Demo Test Frame");//overrides the constructor
setSize(350, 200);//Resizes this component so that it has width of 350 and height of 200
comboBox = new JComboBox();//invokes the class JComboBox
comboBox.addItem("jdbc:odbc:VideoLibrary");//adds the specified item to the end of the scrolling list
qtm = new QueryTableModel();//invokes the class QueryTableModel
JTable table = new JTable(qtm);//a class that shows and changes regular two-dimensional tables of cells
JScrollPane scrollpane = new JScrollPane(table);//a class that provides a scrollable view of a lightweight component
JPanel p1 = new JPanel();//a class that puts the combo box and query field in a panel
p1.setLayout(new GridLayout(3, 2));//Sets the layout manager for this container
p1.add(comboBox);//Appends the specified component to the end of this container
p1.add(new JLabel("Enter your query: "));//Appends the specified component to the end of this container
p1.add(queryField = new JTextField());//Appends the specified component to the end of this container
p1.add(new JLabel("Click here to send: "));//Appends the specified component to the end of this container
JButton jb = new JButton("Search");//a class that is an implementation of a "push" button
jb.addActionListener(new ActionListener(){//Adds an ActionListener to the button
public void actionPerformed(ActionEvent e){
qtm.setHostURL();//invokes the method setHostURL
qtm.setQuery(queryField.getText().trim());//invokes the method setQuery; and returns the text that is presented by this text component and returns a copy of the string, with leading and trailing whitespaces omitted
} );//end addActionListener
p1.add(jb);//Appends the specified component to the end of this container
getContentPane().add(p1, BorderLayout.NORTH);//Returns the content pane
getContentPane().add(scrollpane, BorderLayout.CENTER);//Returns the content pane
}//end Demo
}//end class Demo
import java.sql.*;//Provides the API for accessing and processing data stored in a data source using the Java programming language
import java.io.*;//Provides for system input and output through data streams, serialization and the file system
import java.util.Vector;//provides a class that implements a growable array of objects
import javax.swing.*;//Provides a set of lightweight components that, to the maximum degree possible, work the same on all platforms
import javax.swing.table.*;//Provides classes and interfaces for dealing with javax.swing.JTable
public class QueryTableModel extends AbstractTableModel{
Vector cache;//a class that constructs an empty vector so that its internal data array has size 10 and its standard capacity increment is zero
int colCount;//a variable that counts the number of columns in the three tables
String[] headers;//a class that represents character strings and all string literals in this program are implemented as instances of the String class
Connection db;//an interface that allows a connection to be made to a database
Statement statement;//an interface that allows executes the given SQL statement, which returns a single ResultSet object
String currentURL;//a variable that allows the URL to be displayed in a combo box
public QueryTableModel(){//a constructor
cache=new Vector();//constructs an empty vector so that its internal data array has size 10 and its standard capacity increment is zero
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");//used by opening a JDBC connection using an URL
}//end try
catch(Exception e){
System.out.println("problem loading the driver ");//an error message
}//end catch
}//end QueryTableModel
public String getColumnName(int i){//Returns the designated column's name
return headers;//returns the name of each column in the three table
}//end getColumnName
public int getColumnCount(){//Returns the number of columns in the column model
return colCount;//returns the number of columns in the three tables
}//end getColumnCount
public int getRowCount(){//Returns the number of rows in this table's model
return cache.size();//returns the number of components in the vector
}//end getRowCount
public Object getValueAt(int row, int col){//Returns the cell value at row and column
return ((String[])cache.elementAt(row))[col];//Returns the component at the specified index
}//end getValueAt
public void setHostURL(){//sets the URL for the database
String url = "jdbc:odbc:VideoLibrary";//a variable that allows a connection to be made to a database called VideoLibrary
closeDB();//invokes the method closeDB()
try{
db=DriverManager.getConnection(url,"","");//tries to create a connection with the database using the DriverManager class
statement=db.createStatement();//Creates a Statement object for sending SQL statements to the database
}//end try
catch(Exception e){
System.out.println("Could not initialize the database.");//an error message
e.printStackTrace();//a Throwable method that prints this throwable and it's backtrace to the standard error stream
}//end catch
}//end setHostURL
public void setQuery(String q){//sets the kind of query that is to be sent to the database
cache=new Vector();//constructs an empty vector so that its internal data array has size 10 and its standard capacity increment is zero
String s="select * from Product";//a variable that causes all the data that is in the product table to be displayed in a JTable, which also means that all the data that is in both the member and rental tables can also be displayed in a JTable
try{
ResultSet rs=statement.executeQuery(q);//an interface that is used to generate a database result set by executing a statement that queries the database
ResultSetMetaData meta=rs.getMetaData();//an interface that is used to get information about the types and properties of the columns in a ResultSet object
colCount=meta.getColumnCount();//Returns the number of columns in this ResultSet object
headers=new String[colCount];//gets the name of each column in the three tables
for(int h=1;h<=colCount;h++){
headers[h-1]=meta.getColumnName(h);//Get the designated column's name
}//end for
while(rs.next()){
String[] record=new String[colCount];//stores the name of each column in the three tables in memory
for(int i=0;i<colCount;i++){
record[i]=rs.getString(i+1);//Retrieves the value of the designated column in the current row of this ResultSet object as a String
}//end for
cache.addElement(record);//Adds the specified component to the end of this vector, increasing its size by one
}//end while
fireTableChanged(null);//Forwards the given notification event to all TableModelListeners that registered themselves as listeners for this table model
}//end try
catch(Exception e){
cache=new Vector();//constructs an empty vector so that its internal data array has size 10 and its standard capacity increment is zero
e.printStackTrace();//a Throwable method that prints this throwable and it's backtrace to the standard error stream
}//end catch
}//end setQuery
public void initDB(String url){
try{
db=DriverManager.getConnection(url);//tries to create a connection with the database using the DriverManager class
statement=db.createStatement();//Creates a Statement object for sending SQL statements to the database
}//end try
catch(Exception e){
System.out.println("Could not initialize the database.");//an error message
e.printStackTrace();//a Throwable method that prints this throwable and it's backtrace to the standard error stream
}//end catch
}//end initDB
public void closeDB(){
try{
if(statement!=null){
statement.close();//Releases this Statement object's database and JDBC resources immediately instead of waiting for this to happen when it is automatically closed
}//end if
if(db!=null){
db.close();//Releases this Connection object's database and JDBC resources immediately instead of waiting for them to be automatically released
}//end if
}//end try
catch(Exception e){
System.out.println("Could not close the current connection.");//an error message
e.printStackTrace();//a Throwable method that prints this throwable and it's backtrace to the standard error stream
}//end catch
}//end closeDB
}//end class QueryTableModelhere's an uncommented version of the code.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.table.*;
import javax.swing.JOptionPane;
import java.sql.*;
public class Demo extends JFrame{
static String url = "jdbc:odbc:VideoLibrary";
static Statement stmt;
static Connection con;
JTextField hostField;
JTextField queryField;
QueryTableModel qtm;
JComboBox comboBox;
public static void main(String args[]){
int choice=-1;
do{
choice=getChoice();
if(choice!=0){
getSelected(choice);
}while(choice!=5);
System.exit(0);
public static int getChoice(){
String choice;
int ch;
choice = JOptionPane.showInputDialog(null,"1. Maintain product details\n"+"2. Maintain member details\n"+"3. Maintain rental details\n"+"4. View product, member and rental details\n"+"5. Log Off\n\n"+"Enter your choice");
ch = Integer.parseInt(choice);
return ch;
public static void getSelected(int choice){
if(choice==1){
maintainProductDetails();
if(choice==2){
maintainMemberDetails();
if(choice==3){
maintainRentalDetails();
if(choice==4){
Demo test = new Demo();
test.setVisible(true);
public static Connection getConnection(){
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
catch(java.lang.ClassNotFoundException e){
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
try {
con=DriverManager.getConnection(url,"","");
catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
return con;
public static void maintainProductDetails(){
Connection con = getConnection();
String addProduct1, addProduct2, addProduct3, addProduct4, addProduct5, addProduct6, addProduct7, addProduct8, addProduct9, addProduct10;
addProduct1 = "insert into Product values (110001, 'The Killers - Sams Town', 5.00, 'G', 'CD', 2006)";
addProduct2 = "insert into Product values (110002, 'Robbie Williams - Rudebox', 5.00, 'G', 'CD', 2006)";
addProduct3 = "insert into Product values (110003, 'Razorlight - Razorlight', 5.00, 'G', 'CD', 2006)";
addProduct4 = "insert into Product values (110004, 'My Chemical Romance - The Black Parade', 5.00, 'G', 'CD', 2006)";
addProduct5 = "insert into Product values (110005, 'Snow Patrol - Eyes Open', 5.00, 'G', 'CD', 2006)";
addProduct6 = "insert into Product values (110006, 'Scissor Sisters - Ta-Dah!', 5.00, 'G', 'CD', 2006)";
addProduct7 = "insert into Product values (110007, 'Lovesounds - Justin Timberlake', 5.00, 'G', 'CD', 2006)";
addProduct8 = "insert into Product values (110008, 'Director - We thrive on big cities', 5.00, 'G', 'CD', 2006)";
addProduct9 = "insert into Product values (110009, 'Roxette - Roxette hits', 5.00, 'G', 'CD', 2006)";
addProduct10 = "insert into Product values (110010, '***** Cat Dolls - PCD', 5.00, 'G', 'CD', 2006)";
try {
stmt = con.createStatement();
stmt.executeUpdate(addProduct1);
stmt.executeUpdate(addProduct2);
stmt.executeUpdate(addProduct3);
stmt.executeUpdate(addProduct4);
stmt.executeUpdate(addProduct5);
stmt.executeUpdate(addProduct6);
stmt.executeUpdate(addProduct7);
stmt.executeUpdate(addProduct8);
stmt.executeUpdate(addProduct9);
stmt.executeUpdate(addProduct10);
stmt.close();
con.close();
catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
public static void maintainMemberDetails(){
Connection con = getConnection();
String addMember1, addMember2, addMember3, addMember4, addMember5, addMember6, addMember7, addMember8, addMember9, addMember10;
addMember1 = "insert into Member values (1234, 'Ann', 'Smyth', 'Upper Killult, Falcarragh, Co. Donegal', '(074)-9135210', '(087)-2030172', #5/11/85#, #5/12/06#)";
addMember2 = "insert into Member values (2345, 'John', 'Murphy', 'Lower Killult, Falcarragh, Co. Donegal', '(074)-9135211', '(087)-2030173', #4/12/85#, #6/13/06#)";
addMember3 = "insert into Member values (1324, 'James', 'McFadden', 'Lower Ardsbeg, Gortahork, Co. Donegal', '(074)-9165314', '(087)-2030171', #4/11/85#, #6/14/06#)";
addMember4 = "insert into Member values (1235, 'Frankie', 'Ferry', 'Ardsmore, Gortahork, Co. Donegal', '(074)-9165325', '(087)-2031234', #6/13/60#, #6/15/06#)";
addMember5 = "insert into Member values (1236, 'Daniel', 'McKimm', 'Ballyness, Falcarragh, Co. Donegal', '(074)-9135212', '(087)-2030184', #5/14/73#, #6/16/06#)";
addMember6 = "insert into Member values (2346, 'Stephen', 'Doohan', 'Ballyness, Falcarragh, Co. Donegal', '(074)-9135213', '(087)-2030185', #6/13/85#, #5/13/06#)";
addMember7 = "insert into Member values (2347, 'James', 'Ferry', 'Meenlaragh, Gortahork, Co.Donegal', '(074)-9165360', '(087)-2031345', #9/12/85#, #5/14/06#)";
addMember8 = "insert into Member values (2348, 'Liam', 'Cannon', 'Derryconner, Gortahork, Co.Donegal', '(074)-9165324', '(087)-2031456', #4/11/86#, #5/15/06#)";
addMember9 = "insert into Member values (2401, 'Ciaran', 'Ferry', 'Brinalack, Gweedore, Co.Donegal', '(074)-9176425', '(087)-2030282', #9/12/85#, #5/16/06#)";
addMember10 = "insert into Member values (2402, 'Ciaran', 'McGee', 'Derrybeg, Gweedore, Co.Donegal', '(074)-9176536', '(087)-2030393', #9/14/85#, #5/18/06#)";
try{
stmt = con.createStatement();
stmt.executeUpdate(addMember1);
stmt.executeUpdate(addMember2);
stmt.executeUpdate(addMember3);
stmt.executeUpdate(addMember4);
stmt.executeUpdate(addMember5);
stmt.executeUpdate(addMember6);
stmt.executeUpdate(addMember7);
stmt.executeUpdate(addMember8);
stmt.executeUpdate(addMember9);
stmt.executeUpdate(addMember10);
stmt.close();
con.close();
catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
public static void maintainRentalDetails(){
Connection con = getConnection();
String addRental1, addRental2, addRental3, addRental4, addRental5, addRental6, addRental7, addRental8, addRental9, addRental10;
addRental1 = "insert into Rental values (110001, 'The Killers - Sams Town', 1234, 'Ann', 'Smyth', #9/01/06#, #9/10/06#, 'Yes', 2.00)";
addRental2 = "insert into Rental values (120001, 'Mission Impossible 3', 2345, 'John', 'Murphy', #9/02/06#, #9/09/06#, 'No', 0.00)";
addRental3 = "insert into Rental values (130001, 'Need for Special Carbon', 1324, 'James', 'McFadden', #9/03/06#, #9/12/06#, 'Yes', 2.00)";
addRental4 = "insert into Rental values (110002, 'Robbie Williams - Rudebox', 1235, 'Frankie', 'Ferry', #9/04/06#, #9/11/06#, 'No', 0.00)";
addRental5 = "insert into Rental values (120015, 'Prime', 1236, 'Daniel', 'McKimm', #9/05/06#, #9/14/06#, 'Yes', 2.00)";
addRental6 = "insert into Rental values (130015, 'FIFA 07', 2346, 'Stephen', 'Doohan', #9/06/06#, #9/13/06#, 'No', 0.00)";
addRental7 = "insert into Rental values (110009, 'Roxette - Roxette hits', 2347, 'James', 'Ferry', #9/07/06#, #9/16/06#, 'Yes', 2.00)";
addRental8 = "insert into Rental values (120003, 'The Break Up', 2348, 'Liam', 'Cannon', #9/08/06#, #9/15/06#, 'No', 0.00)";
addRental9 = "insert into Rental values (130027, 'Gears of War', 2401, 'Ciaran', 'Ferry', #9/09/06#, #9/18/06#, 'Yes', 2.00)";
addRental10 = "insert into Rental values (110021, 'Scooter - Mind the Gap', 2402, 'Ciaran', 'McGee', #9/10/06#, #9/17/06#, 'No', 0.00)";
try{
stmt = con.createStatement();
stmt.executeUpdate(addRental1);
stmt.executeUpdate(addRental2);
stmt.executeUpdate(addRental3);
stmt.executeUpdate(addRental4);
stmt.executeUpdate(addRental5);
stmt.executeUpdate(addRental6);
stmt.executeUpdate(addRental7);
stmt.executeUpdate(addRental8);
stmt.executeUpdate(addRental9);
stmt.executeUpdate(addRental10);
stmt.close();
con.close();
catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
public Demo(){
super("Demo Test Frame");
setSize(350, 200);
comboBox = new JComboBox();
comboBox.addItem("jdbc:odbc:VideoLibrary");
qtm = new QueryTableModel();
JTable table = new JTable(qtm);
JScrollPane scrollpane = new JScrollPane(table);
JPanel p1 = new JPanel();
p1.setLayout(new GridLayout(3, 2));
p1.add(comboBox);
p1.add(new JLabel("Enter your query: "));
p1.add(queryField = new JTextField());
p1.add(new JLabel("Click here to send: "));
JButton jb = new JButton("Search");
jb.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
qtm.setHostURL();
qtm.setQuery(queryField.getText().trim());
p1.add(jb);
getContentPane().add(p1, BorderLayout.NORTH);
getContentPane().add(scrollpane, BorderLayout.CENTER);
import java.sql.*;
import java.io.*;
import java.util.Vector;
import javax.swing.*;
import javax.swing.table.*;
public class QueryTableModel extends AbstractTableModel{
Vector cache;
int colCount;
String[] headers;
Connection db;
Statement statement;
String currentURL;
public QueryTableModel(){
cache=new Vector();
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
catch(Exception e){
System.out.println("problem loading the driver ");
public String getColumnName(int i){
return headers;
public int getColumnCount(){
return colCount;
public int getRowCount(){
return cache.size();
public Object getValueAt(int row, int col){
return ((String[])cache.elementAt(row))[col];
public void setHostURL(){
String url = "jdbc:odbc:VideoLibrary";
closeDB();
try{
db=DriverManager.getConnection(url,"","");
statement=db.createStatement();
catch(Exception e){
System.out.println("Could not initialize the database.");
e.printStackTrace();
public void setQuery(String q){
cache=new Vector();
String s="select * from Product";
try{
ResultSet rs=statement.executeQuery(q);
ResultSetMetaData meta=rs.getMetaData();
colCount=meta.getColumnCount();
headers=new String[colCount];
for(int h=1;h<=colCount;h++){
headers[h-1]=meta.getColumnName(h);
while(rs.next()){
String[] record=new String[colCount];
for(int i=0;i<colCount;i++){
record[i]=rs.getString(i+1);
cache.addElement(record);
fireTableChanged(null);
catch(Exception e){
cache=new Vector();
e.printStackTrace();
public void initDB(String url){
try{
db=DriverManager.getConnection(url);
statement=db.createStatement();
catch(Exception e){
System.out.println("Could not initialize the database.");
e.printStackTrace();
public void closeDB(){
try{
if(statement!=null){
statement.close();
if(db!=null){
db.close();
catch(Exception e){
System.out.println("Could not close the current connection.");
e.printStackTrace(); -
Issu for running insert statement in oracle procedure.
Hi expert,
I ran a oracle procedure with a insert statement inside as:
insert into table1 select....
but I got error message related to this insert statement as "SQLERRM= ORA-08103: object no longer exists"
I ran this statement separately in toad, no error message, but no data result from this execute.
please tell how to fix this issue.
Many Thanks,
Edited by: 918440 on 27-Jun-2012 8:04 AMHi friend,
my insert statement is as follows:
INSERT INTO HIROC_RU_FACT_S
select
pp.policy_fk,
pp.transaction_log_fk,
p.policy_no,
p.policy_type_code,
hiroc_rpt_user.hiroc_get_entity_name(pp.policy_fk,'POLHOLDER') policy_holder,
pp.risk_fk,
r.risk_base_record_fk,
r.entity_fk,
hiroc_sel_entity_risk_name2 (pp.risk_fk,r.entity_fk) risk_name,
substr(trim(nvl(r.county_code_used_to_rate,pth.issue_state_code)),1,2) rating_state_code,
hiroc_get_province_name(substr(trim(nvl(r.county_code_used_to_rate,pth.issue_state_code)),1,2), 'PROVINCE_CODE', 'L') rating_state_name,
hiroc_get_provicne_pol_prefix(substr(trim(nvl(r.county_code_used_to_rate,pth.issue_state_code)),1,2),p.policy_type_code) rating_prov_pol_prefix,
nvl(r.risk_cls_used_to_rate,pth.peer_groups_code) rating_peer_group_code,
hiroc_get_lookup_desc('PEER_GROUP',nvl(r.risk_cls_used_to_rate,pth.peer_groups_code),'L') rating_peer_group_name,
pth.policy_term_history_pk,
pth.term_base_record_fk,
to_char(pth.effective_from_date,'yyyy') term_effective_year,
c.coverage_pk,
c.coverage_base_record_fk,
pc.coverage_code,
c.product_coverage_code,
pc.long_description,
pp.coverage_component_code,
c.effective_from_date,
c.effective_to_date,
cls.coverage_code coverage_class_code,
cls.coverage_long_desc coverage_class_long_desc,
decode(pp.coverage_component_code ,'GROSS',cls.exposure_unit,null) exposure_unit, --hiroc_get_expos_units_by_cov(c.coverage_pk,pc.coverage_code,c.effective_from_date,c.effective_to_date) exposure_unit,
decode(pp.coverage_component_code ,'GROSS',cls.number_of_patient_day,null) number_of_patient_day,
pth.effective_from_date term_eff_from_date,
pth.effective_to_date term_eff_to_date,
pp.premium_amount premium_amount,
(case when (pc.coverage_code in ('CP','MC1','MC2','MC3','MC4','HR','F') or pc.coverage_code like 'ST%') and
pp.coverage_component_code != 'RISKMGMT' then
(nvl(pp.premium_amount,0))
else
0
end) primary_premium,
(hiroc_get_risk_units(hiroc_get_provicne_pol_prefix(substr(trim(nvl(r.county_code_used_to_rate,pth.issue_state_code)),1,2),p.policy_type_code)-- rating_prov_pol_prefix
,nvl(r.risk_cls_used_to_rate,pth.peer_groups_code) -- rating_peer_group_code
,cls.coverage_code --coverage_class_code
,decode(pp.coverage_component_code ,'GROSS',cls.exposure_unit,null)
,pp.premium_amount
,(case when (pc.coverage_code in ('CP','MC1','MC2','MC3','MC4','HR','F') or pc.coverage_code like 'ST%') and
pp.coverage_component_code != 'RISKMGMT' then
(nvl(pp.premium_amount,0))
else
0
end) -- primary_premium
,p.policy_type_code
,trunc(pth.effective_to_date))) risk_units
from proddw_mart.rmv_territory_makeup tm,
proddw_mart.rmv_premium_class_makeup pcm,
proddw_mart.rmv_product_coverage pc,
proddw_mart.rmv_coverage c,
proddw_mart.rmv_risk r,
proddw_mart.rmv_policy_term_history pth,
proddw_mart.rmv_policy p,
proddw_mart.rmv_transaction_log tl,
proddw_mart.rmv_policy_premium pp,
(select /* +rule */
p.policy_no,
p.policy_start_date,
p.policy_end_date,
r.risk_pk,
r.risk_description,
c.coverage_pk,
c.parent_coverage_base_record_fk,
pc.parent_product_covg_code,
pc.coverage_code,
pc.short_description coverage_short_desc,
pc.long_description coverage_long_desc,
c.exposure_unit,
pc.exposure_basis_code,
c.number_of_patient_day,
p.policy_start_date policy_effective_date,
p.policy_end_date policy_expiry_date,
c.effective_from_date,
c.effective_to_date,
to_char(c.effective_from_date,'YYYY') class_eff_year
from proddw_mart.odwr_coverage_only c
,proddw_mart.odwr_product_coverage pc
,proddw_mart.odwr_risk r
,proddw_mart.odwr_policy p
where pc.code = c.product_coverage_code
and pc.parent_product_covg_code is not null -- coverage classes only
and r.risk_pk = c.risk_base_record_fk
and c.accounting_to_date = to_date('1/1/3000','mm/dd/yyyy') -- only open records
and c.base_record_b = 'N'
and p.base_record_b = 'N'
and p.policy_pk = r.policy_fk
and p.accounting_to_date = to_date('1/1/3000','mm/dd/yyyy') -- only open records
group by p.policy_no,
p.policy_start_date,
p.policy_end_date,
r.risk_pk,
r.risk_description,
c.coverage_pk,
c.parent_coverage_base_record_fk,
pc.parent_product_covg_code,
pc.coverage_code,
pc.short_description, -- coverage_short_desc,
pc.long_description, -- coverage_long_desc,
c.exposure_unit,
pc.exposure_basis_code,
c.number_of_patient_day,
p.policy_start_date, -- policy_effective_date,
p.policy_end_date, -- policy_expiry_date,
c.effective_from_date,
c.effective_to_date,
to_char(c.effective_from_date,'YYYY')-- class_eff_year
) cls
where tm.risk_type_code = r.risk_type_code
and tm.county_code = r.county_code_used_to_rate
and tm.effective_from_date <= pp.rate_period_from_date
and tm.effective_to_date > pp.rate_period_from_date
and pcm.practice_state_code (+) = r.practice_state_code
and pcm.risk_class_code (+) = r.risk_cls_used_to_rate
and nvl(pcm.effective_from_date, pp.rate_period_from_date) <= pp.rate_period_from_date
and nvl(pcm.effective_to_date, to_date('01/01/3000','mm/dd/yyyy')) > pp.rate_period_from_date
and pc.code = c.product_coverage_code
and c.base_record_b = 'N'
and ( c.record_mode_code = 'OFFICIAL'
and (c.closing_trans_log_fk is null or
c.closing_trans_log_fk != tl.transaction_log_pk)
or c.record_mode_code = 'TEMP'
and c.transaction_log_fk = tl.transaction_log_pk )
and c.parent_coverage_base_record_fk is null
and c.effective_from_date < c.effective_to_date
and c.effective_from_date <= pp.rate_period_from_date
and c.effective_to_date > pp.rate_period_from_date
and c.accounting_from_date <= tl.accounting_date
and c.accounting_to_date > tl.accounting_date
and c.coverage_base_record_fk=pp.coverage_fk
and r.base_record_b = 'N'
and ( r.record_mode_code = 'OFFICIAL'
and (r.closing_trans_log_fk is null or
r.closing_trans_log_fk != tl.transaction_log_pk)
or r.record_mode_code = 'TEMP'
and r.transaction_log_fk = tl.transaction_log_pk )
and r.effective_from_date < r.effective_to_date
and r.effective_from_date <= pp.rate_period_from_date
and r.effective_to_date > pp.rate_period_from_date
and r.accounting_from_date <= tl.accounting_date
and r.accounting_to_date > tl.accounting_date
and r.risk_base_record_fk = pp.risk_fk
and pth.base_record_b = 'N'
and ( pth.record_mode_code = 'OFFICIAL'
and (pth.closing_trans_log_fk is null or
pth.closing_trans_log_fk != tl.transaction_log_pk)
or pth.record_mode_code = 'TEMP'
and pth.transaction_log_fk = tl.transaction_log_pk )
and pth.accounting_from_date <= tl.accounting_date
and pth.accounting_to_date > tl.accounting_date
and pth.term_base_record_fk = pp.policy_term_fk
and p.policy_pk = pp.policy_fk
and tl.transaction_log_pk = pp.transaction_log_fk
and pp.active_premium_b = 'Y'
and pp.rate_period_type_code in ('CS_PERIOD','SR_PERIOD')
and pp.rate_period_to_date > pp.rate_period_from_date
and tl.accounting_date <= sysdate
and p.policy_cycle_code = 'POLICY'
and substr(p.policy_no,1,1) <> 'Q'
and tl.transaction_log_pk = (select max(pp.transaction_log_fk)
from proddw_mart.rmv_policy_premium pp,proddw_mart.rmv_transaction_log tl2
where pth.term_base_record_fk = pp.policy_term_fk
and pp.transaction_log_fk = tl2.transaction_log_pk
and tl2.accounting_date <= sysdate )
and p.policy_type_code in ('LIABCRIME','MIDWIFE')
and pth.accounting_to_date = to_date('01/01/3000','mm/dd/yyyy') --<<<******* eliminates duplicates
and p.policy_no = cls.policy_no
-- and r.risk_pk = cls.risk_pk
and c.coverage_base_record_fk = cls.parent_coverage_base_record_fk(+)
and cls.effective_from_date < pth.effective_to_date -- from date less than period end date
and cls.effective_to_date > pth.effective_from_date -- to date greater than period start date
and cls.policy_effective_date < pth.effective_to_date -- from date less than period end date
and cls.policy_expiry_date > pth.effective_from_date -- to date greater than period start date
group by pp.policy_fk,
pp.transaction_log_fk,
p.policy_no,
p.policy_type_code,
pp.risk_fk,
r.risk_base_record_fk,
r.entity_fk,
substr(trim(nvl(r.county_code_used_to_rate,pth.issue_state_code)),1,2), -- rating_state_code,
r.county_code_used_to_rate,
pth.issue_state_code,
nvl(r.risk_cls_used_to_rate,pth.peer_groups_code) , -- rating_peer_group_code,
r.risk_cls_used_to_rate,
pth.peer_groups_code,
pth.policy_term_history_pk,
pth.term_base_record_fk,
to_char(pth.effective_from_date,'yyyy'), --term_effective_year,
c.coverage_pk,
c.coverage_base_record_fk,
pc.coverage_code,
c.product_coverage_code,
pc.long_description,
pp.coverage_component_code,
c.effective_from_date,
c.effective_to_date,
cls.coverage_code, -- coverage_class_code,
cls.coverage_long_desc, -- coverage_class_long_desc,
decode(pp.coverage_component_code ,'GROSS',cls.exposure_unit,null),-- exposure_unit,
decode(pp.coverage_component_code ,'GROSS',cls.number_of_patient_day,null), -- number_of_patient_day,
pth.effective_from_date, --term_eff_from_date,
pth.effective_to_date, --, --term_eff_to_date,
pp.premium_amount ;Edited by: BluShadow on 27-Jun-2012 16:12
added {noformat}{noformat} tags for readability. PLEASE READ {message:id=9360002} AS PREVIOUSLY REQUESTED! & -
VLD-1119: Unable to generate Multi-table Insert statement for some or all t
Hi All -
I have a map in OWB 10.2.0.4 which is ending with following error: -
VLD-1119: Unable to generate Multi-table Insert statement for some or all targets.*
Multi-table insert statement cannot be generated for some or all of the targets due to upstream graphs of those targets are not identical on "active operators" such as "join".*
The map is created with following logic in mind. Let me know if you need more info. Any directions are highly appreciated and many thanks for your inputs in advance: -
I have two source tables say T1 and T2. There are full outer joined in a joiner and output of this joined is passed to an expression to evaluate values of columns based on
business logic i.e. If T1 is available than take T1.C1 else take T2.C1 so on.
A flag is also evaluated in the expression because these intermediate results needs to be joined to third source table say T3 with different condition.
Based on value taken a flag is being set in the expression which is used in a splitter to get results in three intermediate tables based on flag value evaluated earlier.
These three intermediate tables are all truncate insert and these are unioned to fill a final target table.
Visually it is something like this: -
T1 -- T3 -- JOINER1
| -->Join1 (FULL OUTER) --> Expression -->SPLITTER -- JOINER2 UNION --> Target Table
| JOINER3
T2 --
Please suggest.I verified that their is a limitation with the splitter operator which will not let you generate a multi split having more than 999 columns in all.
I had to use two separate splitters to achieve what I was trying to do.
So the situation is now: -
Siource -> Split -> Split 1 -> Insert into table -> Union1---------Final tableA
Siource -> Split -> Split 2 -> Insert into table -> Union1 -
Generate Insert Statement Script to Extract Data from Table in Oracle 7i
Hi all, I have an old Oracle legacy system that is running for over 15 years.Every now and then we need to extract data from this table@ ORacle 7i to be imported back to Oracle 10G.
My thoughts are to create a script of Insert statements in oracle 7 and that to be deployed back to Oracle 10G.
I found this scripts in Google and not sure how exactly this works.Any explanation on thsi scripts , would be greatly appreciated.I find this scripst may help to generate a set of insert statements from that table to the latest table at 10G.
<pre>
-- Step 1: Create this procedure:
create or replace Function ExtractData(v_table_name varchar2) return varchar2 As
b_found boolean:=false;
v_tempa varchar2(8000);
v_tempb varchar2(8000);
v_tempc varchar2(255);
begin
for tab_rec in (select table_name from user_tables where table_name=upper(v_table_name))
loop
b_found:=true;
v_tempa:='select ''insert into '||tab_rec.table_name||' (';
for col_rec in (select * from user_tab_columns
where
table_name=tab_rec.table_name
order by
column_id)
loop
if col_rec.column_id=1 then
v_tempa:=v_tempa||'''||chr(10)||''';
else
v_tempa:=v_tempa||',''||chr(10)||''';
v_tempb:=v_tempb||',''||chr(10)||''';
end if;
v_tempa:=v_tempa||col_rec.column_name;
if instr(col_rec.data_type,'CHAR') > 0 then
v_tempc:='''''''''||'||col_rec.column_name||'||''''''''';
elsif instr(col_rec.data_type,'DATE') > 0 then
v_tempc:='''to_date(''''''||to_char('||col_rec.column_name||',''mm/dd/yyyy hh24:mi'')||'''''',''''mm/dd/yyyy hh24:mi'''')''';
else
v_tempc:=col_rec.column_name;
end if;
v_tempb:=v_tempb||'''||decode('||col_rec.column_name||',Null,''Null'','||v_tempc||')||''';
end loop;
v_tempa:=v_tempa||') values ('||v_tempb||');'' from '||tab_rec.table_name||';';
end loop;
if Not b_found then
v_tempa:='-- Table '||v_table_name||' not found';
else
v_tempa:=v_tempa||chr(10)||'select ''-- commit;'' from dual;';
end if;
return v_tempa;
end;
show errors
-- STEP 2: Run the following code to extract the data.
set head off
set pages 0
set trims on
set lines 2000
set feed off
set echo off
var retline varchar2(4000)
spool c:\t1.sql
select 'set echo off' from dual;
select 'spool c:\recreatedata.sql' from dual;
select 'select ''-- This data was extracted on ''||to_char(sysdate,''mm/dd/yyyy hh24:mi'') from dual;' from dual;
-- Repeat the following two lines as many times as tables you want to extract
exec :retline:=ExtractData('dept');
print :retline;
exec :retline:=ExtractData('emp');
print :retline;
select 'spool off' from dual;
spool off
@c:\t1
-- STEP3: Run the spooled output c:\recreatedata.sql to recreate data.
Source:http://www.idevelopment.info/data/Oracle/DBA_tips/PL_SQL/PLSQL_5.shtml
</pre>Thanks Justin.
I get what you are saying,i really wanted to see the output of the codes, because the furtherst i could get from that code is
SELECT EXTRACTDATA('MYTABLE') FROM MYTABLE;
and it generated this:
"select 'insert into MYTABLE ('||chr(10)||'DATE1,'||chr(10)||'TIME1,'||chr(10)||'COUNTS) values ('||decode(DATE1,Null,'Null','to_date('''||to_char(DATE1,'mm/dd/yyyy hh24:mi')||''',''mm/dd/yyyy hh24:mi'')')||','||chr(10)||''||decode(TIME1,Null,'Null',TIME1)||','||chr(10)||''||decode(COUNTS,Null,'Null',COUNTS)||');' from MYTABLE;
select '-- commit;' from dual;"
"select 'insert into MYTABLE ('||chr(10)||'DATE1,'||chr(10)||'TIME1,'||chr(10)||'COUNTS) values ('||decode(DATE1,Null,'Null','to_date('''||to_char(DATE1,'mm/dd/yyyy hh24:mi')||''',''mm/dd/yyyy hh24:mi'')')||','||chr(10)||''||decode(TIME1,Null,'Null',TIME1)||','||chr(10)||''||decode(COUNTS,Null,'Null',COUNTS)||');' from MYTABLE;
select '-- commit;' from dual;"
"select 'insert into MYTABLE ('||chr(10)||'DATE1,'||chr(10)||'TIME1,'||chr(10)||'COUNTS) values ('||decode(DATE1,Null,'Null','to_date('''||to_char(DATE1,'mm/dd/yyyy hh24:mi')||''',''mm/dd/yyyy hh24:mi'')')||','||chr(10)||''||decode(TIME1,Null,'Null',TIME1)||','||chr(10)||''||decode(COUNTS,Null,'Null',COUNTS)||');' from MYTABLE;
select '-- commit;' from dual;"
"select 'insert into MYTABLE ('||chr(10)||'DATE1,'||chr(10)||'TIME1,'||chr(10)||'COUNTS) values ('||decode(DATE1,Null,'Null','to_date('''||to_char(DATE1,'mm/dd/yyyy hh24:mi')||''',''mm/dd/yyyy hh24:mi'')')||','||chr(10)||''||decode(TIME1,Null,'Null',TIME1)||','||chr(10)||''||decode(COUNTS,Null,'Null',COUNTS)||');' from MYTABLE;
select '-- commit;' from dual;"
"select 'insert into MYTABLE ('||chr(10)||'DATE1,'||chr(10)||'TIME1,'||chr(10)||'COUNTS) values ('||decode(DATE1,Null,'Null','to_date('''||to_char(DATE1,'mm/dd/yyyy hh24:mi')||''',''mm/dd/yyyy hh24:mi'')')||','||chr(10)||''||decode(TIME1,Null,'Null',TIME1)||','||chr(10)||''||decode(COUNTS,Null,'Null',COUNTS)||');' from MYTABLE;
select '-- commit;' from dual;"
"select 'insert into MYTABLE ('||chr(10)||'DATE1,'||chr(10)||'TIME1,'||chr(10)||'COUNTS) values ('||decode(DATE1,Null,'Null','to_date('''||to_char(DATE1,'mm/dd/yyyy hh24:mi')||''',''mm/dd/yyyy hh24:mi'')')||','||chr(10)||''||decode(TIME1,Null,'Null',TIME1)||','||chr(10)||''||decode(COUNTS,Null,'Null',COUNTS)||');' from MYTABLE;
select '-- commit;' from dual;"
I was expecting a string of
insert into mytable values (19/1/2009,1,1);
insert into mytable values (19/10/2008,5,10);
Thanks for the explanation .
Maybe you are looking for
-
I have Adobe Photoshop Elements 5.0 and am trying to upgrade to 13 - getting error message that "file archive part" of Adobe 13 is missing. When I try to download installers for older products it only goes back to v7, not v5 what to do next?
-
Album cover screen saver?
If I set the screen saver to album cover all I get is a black screen when the screen saver kicks on. I am streaming all of my content and not synching but I'm not sure if this has anything to do with the black screen. I'm assuming that this setting s
-
Data being used even on WiFi? Lumia 1520
I recalled this being an issue with users in the past with other devices until GDR3 fixed this. Somehow on my Lumia 1520 I used over 3GB of "Media Streaming" data according to Data Sense in the last 2 weeks. I don't see how this is possible as I'm co
-
Warning: PC is not authorized for apps
Every time I want to sync my new iPhone 6, iTunes says that this computer is not authorized for the apps on my iPhone. But when I authorize my PC, it says it has been already authorized. What can I do? Thx for Help
-
How do I add the latest Pantone colours in Adobe CC?
Hi all, how do I add the latest Pantone colours in Adobe CC? A customer has asked for Pantone swatches that my latest Pantone libraries just don't have. I can only add CMYK breakdowns in the hope they turn out similar. I've downloaded and registered