How To declare TimeStamp in your code
I am trying to insert date in java application using TimeStamp (java 1.3) to oracle 8i database. But how I want to declare the TimeStamp in my application because I am new in java.
Thank you.
You declare it as "java.sql.Timestamp". There's a JDBC (database) tutorial here:
http://java.sun.com/docs/books/tutorial/jdbc/index.html
Check it out.
Similar Messages
-
Declare Internal Table in Code or in Data Dictionary...Opinions needed?
Is it better to define your internal table and all of its fields in a begin of/end of declaration stmt in your code's data definitions. Or, is it better to create a structure in the Data Dictionary, which means one line of code in your program? Why does one choose the method they prefer?
I am thinking it is best to declare in Data Dictionary, especially since ABAP is now leaning towrds objects. However, I am seeing a lot of field by field definitions in programs. I am very interested in how most programmers accomplish this and why.
Thank-YouI would say that if the internal table is to be used in more than one program, then I would create a structure and/or table type in the ABAP dictionary. If it is to be used in just one program, then I would define it locally.
Regards,
Rich Heilman -
How to declare variables in standard text - so10 t.code
Hello Friends,
How to declare variables in standard text - so10 t.code? Your response will be appreciated much.
Thanks
SriFor Script & Smartform Text - &VAR&
-
How can I use a SCH-LC11 device in CHINA which bought from ebay. I am not Verizon customer but I prefer to using your 4G LTE Router . How can I get the unlock code? The device may have a bad ESN but I only use it in CHINA. Kindly looking forward your reply. Thanks!
It's good to read Antoniad's post. It reassures me that I can use my new iPad as an international communication device which is the reason I purchased the thing. However, I called Verizon today (my provider of cellular data) who told me that I can't just pop in a SIM card as you suggested. He also said that he was from the "Pre-Pay" division of Verizon and he was certain that I couldn't do what I planned to do. I was extremely disappointed as I had called Apple prior to buying the iPad and I read the algorhythm on the website for choosing an iPad before purchasing. Those sources were quite specific and the information seemed clear. I would be able to use my iPad to communicate through cellular connections while traveling on the road, literally, abroad. I was told that I could pop in a data card wherever I was, just as you indicated in your message above, and voila I was good to go. The Verizon rep definitively rained on that parade, but said that I might be able to do this if I have a "Post-Pay" account, a different area of Verizon. I haven't had the chance to talk to this division yet, so I looked to Apple's Support for answers. Maybe I will find out that I can use my iPad as an international communication device while traveling on the road afterall, however, it appears I may need a different type of account (Post-Pay), something I was never warned about. Can I switch to this kind of account? I don't know. I have to find out. If you have any information about this issue, it would be good to share since I strongly suspect there are others who bought the iPad for the same purpose that I have.
-
How to divide your code to many .java files?
I'm having currently over 3000 lines of code and over 70 classes in one file. I would like to divide it so that i would have logical groups of classes. How can that be done. I see only two options here and both of them are bad. Either I do one .java file corresponding to each class, or I put all of them in same file. What can be done to solve my problem?
It is common practice to put one class per file. However with such a large number of classes, such a flat structure could quickly become messy. I don't see any problem with grouping classes within files. You may need to read up on access specifiers (eg; public, private, default access etc) before you split them up, but if your classes are well encapsulated, I can't see any problems ahead.
Another structure you might consider would be to package your classes appropriately. This is a bit tricky to describe, but it's kind of like a directory structure. each package is a self contained logical function of your program. I don't know how well this would suit your purposes.
If you want to split a single file into lots of little ones, you might check out JCreator (www.jcreator.com) as I understand it has a wizard to do this automatically.
HTH -
HT1977 How do you see how much money you have if you already but in your code
How do you see how much money you have if you already but in your code for itunes card
Go to app store in your phone and it will be at the bottom.
-
How often do you place remarks in your code?
Maybe some of you may consider this a stupid question, but how many times do you place reamkrs in your code.
I usually put a remark nearly in everyline I do in java (or some lines) to describe what is happening. However I am not sure whether doing to much reamrks is seen as a wrong thing!!
what do you people think?Is that wrong?No, but It isn't the question that I'd ask. I'd
rather ask some of the following ones:
- does it help with understanding the code?
- does it add anything that's not obvious from the
code?
- if something is not obvious from the code, why not?
bad design? bad naming? or simply a complex
algorithm?
- how much overhead does it add to maintaining the
code? (if I change any of those 4 lines, I'll
probably have to change the comment as well, and
chances are that I'll forget).But from time to time you forget what has been made isnide the code, or worse you have to read other people code. All that you say is true, but I believe that having remarks will help other developers reviewing the code after one is gone. -
How to declare in anonymous block
Declare
CURSOR c_je2acct_othr
IS
SELECT j.jemq_num, j.ml_retail_account,
-- (CASE WHEN j.exer_type = 4 THEN j.sar_shares ELSE j.shares END) shares, -- removed * -1 from sar_shares Manu 12/02/04
/* Commented 02/01/07*/
(CASE WHEN j.exer_type = 4 THEN
fn_get_shares(u.user_id,u.exer_num,u.soc_sec,j.
sar_shares)
ELSE (case when u.exer_type=2 and u.opts_exer!=u.shrs_sold and j.shares=u.shrs_sold then 0 else j.shares end)
END) shares,
-- removed * -1 from sar_shares Manu 12/02/04
j.name_first,
j.name_last, j.exer_type, j.ml_sec_num, j.ivr_plan_num,
j.exer_dt, j.grant_dt, j.user_id, j.mlu_rowid, j.settle_dt,
j.exer_num, j.plan_type, j.grant_num, j.acct_num_othr,
j.add_cancel,
/* (CASE WHEN j.exer_type = 4 THEN j.sar_cash_amount * -1 -- turned negative Manu 12/02/04 ml_retail distr
commented the above line for calculation of proceeds into other account for sar sale.
(CASE WHEN j.exer_type = 4 THEN
Pk_Xop_Citibank_Forex.fn_get_netamount(u.user_id,u.
exer_num,u.soc_sec,
u.sar_cash_amount,NVL(u.comm_value, 0),
NVL(u.tot_fee, 0),
NVL(u.multi_curr_handling_fee, 0))
-- Removed the negative as on ml_exer_upload all values are +ve.
ELSE
( (DECODE(u.exer_type,0,u.opts_exer * u.mkt_prc,u.shrs_sold * u.mkt_prc
- ( ROUND((u.opts_exer * NVL (u.opt_prc, 0)),2)
-- SPIF 39060 Added a Round of condition.
+ DECODE (NVL (u.shrs_wthld_for_taxes, 'N'),
'Y', 0,
ROUND (u.tot_tax, 2)
+ u.tot_fee
+ NVL(u.multi_curr_handling_fee,0)
+ u.comm_value
- u.backup_withholding
END ) AS gl_amt,
T.je_othr_mlacct_jemsg AS vc_trailer_desc,
u.opts_exer ,
u.shrs_sold,
u.rsu_type
FROM TB_XOP_JEMQ j, TB_ML_EXER_UPLOAD u, TB_FC_COMPY T
WHERE j.q_flag = 'N' AND u.je_flag = 'Y'
AND j.entry_dttime >= TRUNC (SYSDATE)
AND j.entry_dttime < TRUNC (SYSDATE) +1
AND j.source = 'X'
AND j.acct_num_othr != ' '
and (case when u.exer_type=2 and u.opts_exer!=u.shrs_sold then (case when j.shares=u.shrs_sold then 0 else 1 end) else 1 end)=1 FIx for PCTUP00566081
AND ( disp_flag <> 'D' OR disp_flag IS NULL ) Added by MARAN ARUNACHALAM on 01/25/2011 for PCTUP00493542 Fix
and j.current_status = '2Q' removed not required now in new plan
AND NOT EXISTS (
SELECT 1
FROM TB_XOP_JEMQ j2
WHERE j2.prev_jemq = j.jemq_num
AND source = 'T'
AND j.add_cancel = j2.add_cancel
AND j.user_id = j2.user_id
AND j.exer_num = j2.exer_num)
AND j.mlu_rowid = u.ROWID
AND 'CMS'||T.compy_acronym||'_USER' = j.user_id
ORDER BY add_cancel DESC;
v_mlac_mesg VARCHAR2(1000);
-- JE_OTHR_MLACCT_JEMSG
BEGIN
dbms_output.put_line('success');
FOR v_je2acct_othr IN c_je2acct_othr
LOOP
dbms_output.put_line('success1');
BEGIN
dbms_output.put_line('success2');
IF v_je2acct_othr.add_cancel = 'C'
THEN
dbms_output.put_line('success3');
UPDATE TB_XOP_JEMQ
SET add_cancel = DECODE(current_status,
'RJ',
add_cancel,
'C'),
q_flag = DECODE(current_status, 'RJ', q_flag, 'N'),
activ_dt = DECODE(current_status,
'RJ',
activ_dt,
SYSDATE)
WHERE prev_jemq = v_je2acct_othr.jemq_num
AND user_id = v_je2acct_othr.user_id
AND exer_num = v_je2acct_othr.exer_num
AND source ='T';
dbms_output.put_line('success4');
ELSIF v_je2acct_othr.add_cancel = 'A'
THEN
dbms_output.put_line('success5');
-- manipulating amount and shares to transfer when different exercise types
v_je2acct_othr.gl_amt :=( CASE
WHEN v_je2acct_othr.exer_type = 0 THEN 0
WHEN v_je2acct_othr.exer_type = 2 AND v_je2acct_othr.opts_exer
!= v_je2acct_othr.shrs_sold
THEN v_je2acct_othr.gl_amt
WHEN v_je2acct_othr.exer_type = 2 AND v_je2acct_othr.opts_exer =
v_je2acct_othr.shrs_sold
THEN v_je2acct_othr.gl_amt
ELSE v_je2acct_othr.gl_amt
END );
---- Commented on 11/01/2006 For Fixing 30585
/* v_je2acct_othr.shares :=( CASE
WHEN v_je2acct_othr.exer_type = 0 THEN v_je2acct_othr.opts_exer
WHEN v_je2acct_othr.exer_type = 2 AND v_je2acct_othr.opts_exer != v_je2acct_othr.shrs_sold
THEN v_je2acct_othr.opts_exer - v_je2acct_othr.shrs_sold
WHEN v_je2acct_othr.exer_type = 2 AND v_je2acct_othr.opts_exer = v_je2acct_othr.shrs_sold
THEN 0
ELSE v_je2acct_othr.shares
END );*/
---- Commented on 11/01/2006 For Fixing 30585
v_je2acct_othr.shares :=( CASE
WHEN v_je2acct_othr.exer_type = 0 THEN v_je2acct_othr.
Shares
--- Replaced opts_exer with the Shares amount from the previous journal for fixing 30585
WHEN v_je2acct_othr.exer_type = 2 AND v_je2acct_othr.opts_exer
!= v_je2acct_othr.shrs_sold and v_je2acct_othr.shares!=0 and v_je2acct_othr.plan_type <> 0 -- Added plantype condition for CQ:PCTUP00493542
THEN v_je2acct_othr.Shares - v_je2acct_othr.shrs_sold
--- Replaced opts_exer with the Shares amount from the previous journal for fixing 30585
WHEN v_je2acct_othr.exer_type = 2 AND v_je2acct_othr.opts_exer =
v_je2acct_othr.shrs_sold
THEN 0
ELSE v_je2acct_othr.shares
END );
dbms_output.put_line('success6');
IF LENGTH(TRIM(v_je2acct_othr.acct_num_othr))=8 OR TRIM(v_je2acct_othr.acct_num_othr) IS NULL
THEN
v_mlac_mesg :=NULL;
ELSE
v_mlac_mesg :='Check the ml a/c length';
dbms_output.put_line('success7');
END IF;
INSERT INTO TB_XOP_JEMQ
(jemq_num,
prev_jemq,
ml_retail_account,
wcma_shares,
shares, wcma_taxes, tax_amt,
wcma_reimburse,
reimburse_amt,
name_first,
name_last, exer_type,
ml_sec_num, wcma_bulking, bulking_amt,
ivr_plan_num,
exer_dt, grant_dt,
user_id, source,
mlu_rowid, settle_dt,
exer_num, plan_type,
grant_num,
vc_trailer_desc, rsu_type
VALUES (Pk_Xop_Get_Jemqnum.fn_xop_get_jemqnum,
v_je2acct_othr.jemq_num,
v_je2acct_othr.acct_num_othr,
-- 2nd ml_retail_account,
v_je2acct_othr.ml_retail_account,
-- move shares from old acct to 2nd acct above
v_je2acct_othr.shares,
--this is SHARES
--wcma_taxes
0,
--tax_amt,
v_je2acct_othr.ml_retail_account,
-- move gl_amt from old acct to 2nd acct above
v_je2acct_othr.gl_amt * -1,
v_je2acct_othr.name_first,
v_je2acct_othr.name_last, v_je2acct_othr.
exer_type,
v_je2acct_othr.ml_sec_num, ' ',
--wcma_bulking,
0,
--bulking_amt,
v_je2acct_othr.ivr_plan_num,
v_je2acct_othr.exer_dt, v_je2acct_othr.
grant_dt,
v_je2acct_othr.user_id, 'T',
--source
v_je2acct_othr.mlu_rowid, v_je2acct_othr.
settle_dt,
v_je2acct_othr.exer_num, v_je2acct_othr.
plan_type,
v_je2acct_othr.grant_num,
v_je2acct_othr.vc_trailer_desc,
v_je2acct_othr.
rsu_type
dbms_output.put_line('success8');
END IF;
EXCEPTION
WHEN OTHERS
THEN
Pr_Xop_Log_Errors ( 'Code :'
|| NVL(v_mlac_mesg,SQLERRM)
|| ' at '
|| USER
|| 'at sub exec block in pop_je2acct_othr'
END;
dbms_output.put_line('success9'); -- end of begin within loop
END LOOP;
--COMMIT;
EXCEPTION
WHEN OTHERS
THEN
Pr_Xop_Log_Errors ( 'Code :'
|| NVL(v_mlac_mesg,SQLERRM)
|| ' at '
|| USER
|| 'at pk_xop_jemq.pop_je2acct_othr'
dbms_output.put_line('success10');
END;}
{ORA-06550: line 10, column 31:
PL/SQL: ORA-00904: "FN_GET_SHARES": invalid identifier
ORA-06550: line 6, column 11:
PL/SQL: SQL Statement ignored
ORA-06550: line 81, column 17:
PLS-00364: loop index variable 'V_JE2ACCT_OTHR' use is invalid
ORA-06550: line 81, column 14:
PL/SQL: Statement ignored}
HI friends, as i am getting two errors when running code in the anonymous block, then how to declare that 2 errors in declare section plz guide me}Noone, will read your code unless it is formatted like below. See the comments added
DECLARE
CURSOR c_je2acct_othr
IS
SELECT j.jemq_num,
j.ml_retail_account,
-- (CASE WHEN j.exer_type = 4 THEN j.sar_shares ELSE j.shares END) shares, -- removed * -1 from sar_shares Manu 12/02/04
/* Commented 02/01/07*/
CASE
WHEN j.exer_type = 4
--"The current user is not seeing the below function fn_get_shares.Privilege issue probably.
THEN fn_get_shares(u.user_id,u.exer_num,u.soc_sec,j. sar_shares)
ELSE (
CASE
WHEN u.exer_type=2
AND u.opts_exer!=u.shrs_sold
AND j.shares =u.shrs_sold
THEN 0
ELSE j.shares
END)
END) shares,
-- removed * -1 from sar_shares Manu 12/02/04
j.name_first,
j.name_last,
j.exer_type,
j.ml_sec_num,
j.ivr_plan_num,
j.exer_dt,
j.grant_dt,
j.user_id,
j.mlu_rowid,
j.settle_dt,
j.exer_num,
j.plan_type,
j.grant_num,
j.acct_num_othr,
j.add_cancel,
/* (CASE WHEN j.exer_type = 4 THEN j.sar_cash_amount * -1 -- turned negative Manu 12/02/04 ml_retail distr
commented the above line for calculation of proceeds into other account for sar sale.
CASE
WHEN j.exer_type = 4
THEN Pk_Xop_Citibank_Forex.fn_get_netamount(u.user_id,u. exer_num,u.soc_sec, u.sar_cash_amount,NVL(u.comm_value, 0), NVL(u.tot_fee, 0), NVL(u.multi_curr_handling_fee, 0))
-- Removed the negative as on ml_exer_upload all values are +ve.
ELSE ( (DECODE(u.exer_type,0,u.opts_exer * u.mkt_prc,u.shrs_sold * u.mkt_prc )) - ( ROUND((u.opts_exer * NVL (u.opt_prc, 0)),2)
-- SPIF 39060 Added a Round of condition.
+ DECODE (NVL (u.shrs_wthld_for_taxes, 'N'), 'Y', 0, ROUND (u.tot_tax, 2) ) + u.tot_fee + NVL(u.multi_curr_handling_fee,0) + u.comm_value ) - u.backup_withholding )
END ) AS gl_amt,
T.je_othr_mlacct_jemsg AS vc_trailer_desc,
u.opts_exer ,
u.shrs_sold,
u.rsu_type
FROM TB_XOP_JEMQ j,
TB_ML_EXER_UPLOAD u,
TB_FC_COMPY T
WHERE j.q_flag = 'N'
AND u.je_flag = 'Y'
AND j.entry_dttime >= TRUNC (SYSDATE)
AND j.entry_dttime < TRUNC (SYSDATE) +1
AND j.source = 'X'
AND j.acct_num_othr != ' '
--and (case when u.exer_type=2 and u.opts_exer!=u.shrs_sold then (case when j.shares=u.shrs_sold then 0 else 1 end) else 1 end)=1 -- FIx for PCTUP00566081
--AND ( disp_flag <> 'D' OR disp_flag IS NULL ) -- Added by MARAN ARUNACHALAM on 01/25/2011 for PCTUP00493542 Fix
--and j.current_status = '2Q' -- removed not required now in new plan
AND NOT EXISTS
(SELECT 1
FROM TB_XOP_JEMQ j2
WHERE j2.prev_jemq = j.jemq_num
AND source = 'T'
AND j.add_cancel = j2.add_cancel
AND j.user_id = j2.user_id
AND j.exer_num = j2.exer_num
AND j.mlu_rowid = u.ROWID
AND 'CMS'
||T.compy_acronym
||'_USER' = j.user_id
ORDER BY add_cancel DESC;
v_mlac_mesg VARCHAR2(1000);
-- JE_OTHR_MLACCT_JEMSG
BEGIN
dbms_output.put_line('success');
FOR v_je2acct_othr IN c_je2acct_othr
LOOP
dbms_output.put_line('success1');
BEGIN
dbms_output.put_line('success2');
IF v_je2acct_othr.add_cancel = 'C' THEN
dbms_output.put_line('success3');
UPDATE TB_XOP_JEMQ
SET add_cancel = DECODE(current_status, 'RJ', add_cancel, 'C'),
q_flag = DECODE(current_status, 'RJ', q_flag, 'N'),
activ_dt = DECODE(current_status, 'RJ', activ_dt, SYSDATE)
WHERE prev_jemq = v_je2acct_othr.jemq_num
AND user_id = v_je2acct_othr.user_id
AND exer_num = v_je2acct_othr.exer_num
AND source ='T';
dbms_output.put_line('success4');
ELSIF v_je2acct_othr.add_cancel = 'A' THEN
dbms_output.put_line('success5');
-- manipulating amount and shares to transfer when different exercise types
--"You cannot assign values to the recor variable declared for a loop. Either define seperate variables or use explicit record variable"
v_je2acct_othr.gl_amt :=
CASE
WHEN v_je2acct_othr.exer_type = 0 THEN
0
WHEN v_je2acct_othr.exer_type = 2 AND v_je2acct_othr.opts_exer != v_je2acct_othr.shrs_sold THEN
v_je2acct_othr.gl_amt
WHEN v_je2acct_othr.exer_type = 2 AND v_je2acct_othr.opts_exer = v_je2acct_othr.shrs_sold THEN
v_je2acct_othr.gl_amt
ELSE
v_je2acct_othr.gl_amt
END );
---- Commented on 11/01/2006 For Fixing 30585
/* v_je2acct_othr.shares :=( CASE
WHEN v_je2acct_othr.exer_type = 0 THEN v_je2acct_othr.opts_exer
WHEN v_je2acct_othr.exer_type = 2 AND v_je2acct_othr.opts_exer != v_je2acct_othr.shrs_sold
THEN v_je2acct_othr.opts_exer - v_je2acct_othr.shrs_sold
WHEN v_je2acct_othr.exer_type = 2 AND v_je2acct_othr.opts_exer = v_je2acct_othr.shrs_sold
THEN 0
ELSE v_je2acct_othr.shares
END );*/
---- Commented on 11/01/2006 For Fixing 30585
v_je2acct_othr.shares :=
CASE
WHEN v_je2acct_othr.exer_type = 0 THEN
v_je2acct_othr. Shares
--- Replaced opts_exer with the Shares amount from the previous journal for fixing 30585
WHEN v_je2acct_othr.exer_type = 2 AND v_je2acct_othr.opts_exer != v_je2acct_othr.shrs_sold AND v_je2acct_othr.shares!=0 AND v_je2acct_othr.plan_type 0 -- Added plantype condition for CQ:PCTUP00493542
THEN
v_je2acct_othr.Shares - v_je2acct_othr.shrs_sold
--- Replaced opts_exer with the Shares amount from the previous journal for fixing 30585
WHEN v_je2acct_othr.exer_type = 2 AND v_je2acct_othr.opts_exer = v_je2acct_othr.shrs_sold THEN
0
ELSE
v_je2acct_othr.shares
END );
dbms_output.put_line('success6');
IF LENGTH(TRIM(v_je2acct_othr.acct_num_othr))=8 OR TRIM(v_je2acct_othr.acct_num_othr) IS NULL THEN
v_mlac_mesg :=NULL;
ELSE
v_mlac_mesg :='Check the ml a/c length';
dbms_output.put_line('success7');
END IF;
INSERT
INTO TB_XOP_JEMQ
jemq_num,
prev_jemq,
ml_retail_account,
wcma_shares,
shares,
wcma_taxes,
tax_amt,
wcma_reimburse,
reimburse_amt,
name_first,
name_last,
exer_type,
ml_sec_num,
wcma_bulking,
bulking_amt,
ivr_plan_num,
exer_dt,
grant_dt,
user_id,
source,
mlu_rowid,
settle_dt,
exer_num,
plan_type,
grant_num,
vc_trailer_desc,
rsu_type
VALUES
Pk_Xop_Get_Jemqnum.fn_xop_get_jemqnum,
v_je2acct_othr.jemq_num,
v_je2acct_othr.acct_num_othr,
-- 2nd ml_retail_account,
v_je2acct_othr.ml_retail_account,
-- move shares from old acct to 2nd acct above
v_je2acct_othr.shares,
--this is SHARES
--wcma_taxes
0,
--tax_amt,
v_je2acct_othr.ml_retail_account,
-- move gl_amt from old acct to 2nd acct above
v_je2acct_othr.gl_amt * -1,
v_je2acct_othr.name_first,
v_je2acct_othr.name_last,
v_je2acct_othr. exer_type,
v_je2acct_othr.ml_sec_num,
--wcma_bulking,
0,
--bulking_amt,
v_je2acct_othr.ivr_plan_num,
v_je2acct_othr.exer_dt,
v_je2acct_othr. grant_dt,
v_je2acct_othr.user_id,
'T',
--source
v_je2acct_othr.mlu_rowid,
v_je2acct_othr. settle_dt,
v_je2acct_othr.exer_num,
v_je2acct_othr. plan_type,
v_je2acct_othr.grant_num,
v_je2acct_othr.vc_trailer_desc,
v_je2acct_othr. rsu_type
dbms_output.put_line('success8');
END IF;
EXCEPTION
WHEN OTHERS THEN
Pr_Xop_Log_Errors ( 'Code :' || NVL(v_mlac_mesg,SQLERRM) || ' at ' || USER || 'at sub exec block in pop_je2acct_othr' );
END;
dbms_output.put_line('success9'); -- end of begin within loop
END LOOP;
--COMMIT;
EXCEPTION
WHEN OTHERS THEN
Pr_Xop_Log_Errors ( 'Code :' || NVL(v_mlac_mesg,SQLERRM) || ' at ' || USER || 'at pk_xop_jemq.pop_je2acct_othr' );
dbms_output.put_line('success10');
END;
{code}   -
How to declare a dynamic array in java
I have to use a dynmic array of boolean and the size of this array will defiend throuh the run of the program to explian
boolean[][] a;
a=new boolean[number_of_ raw][number_of_ culm];
after the program run the number_of_ raw and number_of_ culm will defind..so if any body know how to declare this kind of arraies in java please help me.My previous post gives me an idea on how to use ArrayList of ArrayList as dynamic 2 dimensional array.
More info bellow
ArrayList rows = new ArrayList()
ArrayList columns_of_row0 = new ArrayList()
rows.insertAt(0) = columns_of_row0;
ArrayList columns_of_row1 = new ArrayList()
rows.insertAt(1) = columns_of_row1;and so on..
You can't use the code exactly or similar way, it would depend on how this array grows in your application.
But this and my previous post should give an idea on how to insert and retrieve elements from ArrayList when
treated as 2 dimensional array.
Hope this helps. -
How to declare class variable with generic parameters?
I've got a class that declares a type parameter T. I know how to declare a static method, but this doesn't work for a static variable:
public class Test< T >
* Map of String to instances of T.
* error: '(' expected (pointing to =)
* <identifier> expected (pointing to () )
private final static < T > Map< String, T > MAP = new HashMap< String, T >();
* Get instance of type T associated with the given key.
public final static < T > T getType( String key )
return MAP.get( key );
}Edited by: 845859 on Mar 20, 2011 11:46 AMjveritas wrote:
I'm trying to create a generic polymorphic Factory class that contains boilerplate code.
I don't want to have to rewrite the registration code every time I have a different return type and parameter.I haven't seen a case yet where that is reasonable.
If you have hundreds of factories then something is wrong with your code, design and architecture.
If you have a factory which requires large number of a varying input types (producing different types) then something is probably wrong with your code and design.
A reasonable factory usage is one where you have say 20 classes to be created and you need to add a new class every 3 months. Along with additional functionality represented by the class itself and perhaps variances in usage. Thus adding about 3 lines of code to one class is trivial. Conversely if you have hundreds of classes to be created by the factory and you are adding them daily then it is likely that
1. Something is wrong with the architecture which requires a new class every day.
2. You should be using a dynamic mechanism for creation rather than static because you can't roll out a static update that often.
More than that the idiom that leads to factory creation is different for each factory. A factory that creates a database connection is substantially different than the one used in dynamic rules logic processing. A generic version will not be suitable for both.
Actualy the only case I know of where such a factory might be seem to be a 'good' idea is where someone has gotten it into their head that every class should be represented by an interface and every class created by a factory (its own factory.) And of course that is flawed. -
How to declare a bind variable with 'date' data type in command prompt?
how to declare a bind variable with 'date' data type in command prompt?
sql>variable q date;
when i execute it show list of datatypesHi,
As Lokanath said, there are no DATE bind variables.
You can use a VARCHAR2 bind variable, and convert it to a DATE in your SQL statment.
If you're using SQL*Plus, consider a substitution variable. It won't be as efficient as a bind variable, but it will be as convenient.
For example:
DEFINE first_entrry_date = "DATE '2010-06-20''
SELECT ...
WHERE entry_date >= &first_entry_date
{code} -
How to declare a workarea of type index table
Hi Experts,
I am getting error as CT_RESULT is a generic type.Use of this type is only possible for typing field symbols and formal parameters when using the below code. Please help me and let me know how to declare it.
TYPES:BEGIN OF ty_guid,
guid TYPE guid,
END OF ty_guid.
DATA:it_guid TYPE STANDARD TABLE OF ty_guid INITIAL SIZE 0,
it_item TYPE STANDARD TABLE OF bbp_pds_sc_item_d INITIAL SIZE 0.
DATA:wa_guid TYPE ty_guid,
wa_item TYPE bbp_pds_sc_item_d.
FIELD-SYMBOLS: <fs_result> like LINE OF ct_result.
SELECT guid FROM crmd_orderadm_h INTO TABLE it_guid
WHERE object_id IN ct_result.
IF sy-subrc = 0.
LOOP AT it_guid INTO wa_guid.
CALL FUNCTION 'BBP_PD_SC_GETDETAIL'
EXPORTING
i_guid = wa_guid
* I_OBJECT_ID =
* I_ATTACH_WITH_DOC = ' '
i_with_itemdata = 'X'
* I_ITEM_SORTED_BY_HIERARCHY =
* I_WITHOUT_HEADER_TOTALS =
* I_READ_FROM_ARCHIVE = ' '
* IMPORTING
* E_HEADER =
* EV_IS_PD =
* ET_ATTACH =
TABLES
e_item = it_item
* E_ACCOUNT =
* E_PARTNER =
* E_CONFIRM =
* E_LONGTEXT =
* E_LIMIT =
* E_ORGDATA =
* E_TAX =
* E_PRIDOC =
* E_HCF =
* E_ICF =
* E_MESSAGES =
* E_ACTVAL =
* E_ACC_ACTVAL =
* E_HEADER_REL =
* E_ITMLIM_REL =
* E_STATUS =
ENDLOOP.
ENDIF.
IF it_item[] IS NOT INITIAL.
LOOP AT it_item INTO wa_item.
LOOP AT ct_result ASSIGNING <fs_result>.
<fs_result>-zzpurchase_cat = wa_item-be_tracking_no.
* MODIFY ct_result FROM wa_result.
CLEAR wa_result.
ENDLOOP.
CLEAR wa_item.
ENDLOOP.
ENDIF.Hi,
i'm not quite sure where ct_result is first introduced. There seems to be no declaration?
Judging by the name-prefix, it would be a changing parameter of which form?
Where is it populated, since you intend to loop it?
And then, from which hat do you draw wa_result? it neither seems to be declared nor is there an assignment of values.
On the other hand, you're trying to change table ct_result directly by altering a field of an assigned field-symbol. Why do you feel it necessary to follow up with a modify statement?
After so many question-marks i have lost the point of your initial question.
Maybe, you can start with a short description of your intention and a more accurate code-snippet.
Best regards - Jörg -
OrionCMTConnection not closed, check your code. OrionCMTConnection created
Hi everybody, I have an application running in OAS 10g, this application generally works fine, but in the opmn log of my instance in found the next message :
07/01/09 17:01:56 OrionCMTConnection not closed, check your code!
07/01/09 17:01:56 Logical connection not closed, check your code!
07/01/09 17:01:56 Created at:
07/01/09 17:01:56 java.lang.Throwable: OrionCMTConnection created
07/01/09 17:01:56 at com.evermind.sql.OrionCMTConnection.<init>(OrionCMTConnection.java:121)
07/01/09 17:01:56 at com.evermind.sql.OrionCMTConnectionFinalize.<init>(OrionCMTConnectionFinalize.java:42)
07/01/09 17:01:56 at com.evermind.util.ClassOptimizerFactory.getOrionCMTConnection(ClassOptimizerFactory.java:80)
07/01/09 17:01:56 at com.evermind.sql.OrionCMTDataSource.getConnection(OrionCMTDataSource.java:237)
07/01/09 17:01:56 at com.evermind.sql.OrionCMTDataSource.getConnection(OrionCMTDataSource.java:217)
07/01/09 17:01:56 at view.base_control_maq.consulta_t_orden_produccion_cod(base_control_maq.java:1934)
07/01/09 17:01:56 at control_maq._detalle__control__actividad._jspService(_detalle__control__actividad.java:280)
07/01/09 17:01:56 at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
07/01/09 17:01:56 at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:350)
07/01/09 17:01:56 at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:509)
07/01/09 17:01:56 at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:413)
07/01/09 17:01:56 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
07/01/09 17:01:56 at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:824)
07/01/09 17:01:56 at com.evermind.server.http.ServletRequestDispatcher.include(ServletRequestDispatcher.java:121)
07/01/09 17:01:56 at com.evermind.server.http.EvermindPageContext.include(EvermindPageContext.java:267)
07/01/09 17:01:56 at org.apache.struts.tiles.TilesUtilImpl.doInclude(TilesUtilImpl.java:99)
07/01/09 17:01:56 at org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:135)
07/01/09 17:01:56 at org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.java:760)
07/01/09 17:01:56 at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:892)
07/01/09 17:01:56 at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:462)
07/01/09 17:01:56 at templetas.template._jspService(_template.java:68)
07/01/09 17:01:56 at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
07/01/09 17:01:56 at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:350)
07/01/09 17:01:56 at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:509)
07/01/09 17:01:56 at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:413)
07/01/09 17:01:56 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
07/01/09 17:01:56 at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:824)
07/01/09 17:01:56 at com.evermind.server.http.ServletRequestDispatcher.include(ServletRequestDispatcher.java:121)
07/01/09 17:01:56 at com.evermind.server.http.EvermindPageContext.include(EvermindPageContext.java:267)
07/01/09 17:01:56 at org.apache.struts.tiles.TilesUtilImpl.doInclude(TilesUtilImpl.java:99)
07/01/09 17:01:56 at org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:135)
07/01/09 17:01:56 at org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.java:760)
07/01/09 17:01:56 at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:892)
07/01/09 17:01:56 at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:462)
07/01/09 17:01:56 at control_maq._control__actividad._jspService(_control__actividad.java:125)
07/01/09 17:01:56 at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
07/01/09 17:01:56 at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:350)
07/01/09 17:01:56 at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:509)
07/01/09 17:01:56 at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:413)
07/01/09 17:01:56 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
07/01/09 17:01:56 at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:824)
07/01/09 17:01:56 at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330)
07/01/09 17:01:56 at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:222)
07/01/09 17:01:56 at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1063)
07/01/09 17:01:56 at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:263)
07/01/09 17:01:56 at org.apache.struts.action.RequestProcessor.internalModuleRelativeForward(RequestProcessor.java:1001)
07/01/09 17:01:56 at org.apache.struts.tiles.TilesRequestProcessor.internalModuleRelativeForward(TilesRequestProcessor.java:345)
07/01/09 17:01:56 at org.apache.struts.action.RequestProcessor.processForward(RequestProcessor.java:560)
07/01/09 17:01:56 at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:209)
07/01/09 17:01:56 at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
07/01/09 17:01:56 at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
07/01/09 17:01:56 at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
07/01/09 17:01:56 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
07/01/09 17:01:56 at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
07/01/09 17:01:56 at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:239)
07/01/09 17:01:56 at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:663)
07/01/09 17:01:56 at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330)
07/01/09 17:01:56 at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:830)
07/01/09 17:01:56 at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:224)
07/01/09 17:01:56 at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:133)
07/01/09 17:01:56 at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
07/01/09 17:01:56 at java.lang.Thread.run(Thread.java:534)
This error occurred with other java files too, but in the code apparently the jdbc connections are closed. I'm searching since a week the problem and different solutions in the forum but this does not apply for my problem, please help me.
Regards
Jeanette.Thanks Frances, but I set -Ddatasource.verbose=true and get some like this:
Releasing connection com.evermind.sql.DriverManagerXAConnection@1cf6046 to pool (Pool size: 5)
com.evermind.sql.OrionCMTDataSource@1a9a15f: Cache timeout, closing connection (Pool size: 4)
com.evermind.sql.OrionCMTDataSource@1a9a15f: Cache timeout, closing connection (Pool size: 3)
com.evermind.sql.OrionCMTDataSource@1a9a15f: Cache timeout, closing connection (Pool size: 2)
com.evermind.sql.OrionCMTDataSource@1a9a15f: Cache timeout, closing connection (Pool size: 1)
null: Releasing connection com.evermind.sql.DriverManagerXAConnection@6409e1 to pool (Pool size: 1)
I suppose that some connections were closed well and others didn't close in the right form and use cache timeout.
Nevertheless even now I don’t know how to correct the message of connection:
07/01/11 18:31:44 OrionCMTConnection not closed, check your code!
07/01/11 18:31:44 Logical connection not closed, check your code!
07/01/11 18:31:44 Created at:
07/01/11 18:31:44 java.lang.Throwable: OrionCMTConnection created
07/01/11 18:31:44 at com.evermind.sql.OrionCMTConnection.<init>(OrionCMTConnection.java:121)
07/01/11 18:31:44 at com.evermind.sql.OrionCMTConnectionFinalize.<init>(OrionCMTConnectionFinalize.java:42).........
This time in the log I found other lines before the OrionCMTConnection….:
null: Releasing connection com.evermind.sql.DriverManagerXAConnection@d35cb2 to pool (Pool size: 1)
INFO - GenericFilterBean.init(118) | Initializing filter 'hibernateFilter'
INFO - GenericFilterBean.init(143) | Filter 'hibernateFilter' configured successfully
INFO - AbstractBeanFactory.getBean(219) | Creating shared instance of singleton bean 'sessionFactory'
INFO - AbstractBeanFactory.getBean(219) | Creating shared instance of singleton bean 'sessionFactory'
INFO - AbstractBeanFactory.getBean(219) | Creating shared instance of singleton bean 'dataSource'
INFO - AbstractBeanFactory.getBean(219) | Creating shared instance of singleton bean 'dataSource'
INFO - Environment.<clinit>(464) | Hibernate 3.0.5
INFO - Environment.<clinit>(477) | hibernate.properties not found
INFO - Environment.<clinit>(510) | using CGLIB reflection optimizer
INFO - Environment.<clinit>(540) | using JDK 1.4 java.sql.Timestamp handling
I'm totally disoriented now.. please help me
Jane. -
I have taken the cfdump for tmpqry and it shows all data for
the range ( No error at this step ) . But when we exceute this
dbquery we get below mentioned error .
<cfquery name="qry" dbtype="query" >
SELECT *
FROM tmpqry
ORDER BY #arguments.colSort# ASC
</cfquery>
senerio:
I am using createobject to create a reference for component
and call MDArraySort function in the cfc and getting this error .
'The system has attempted to use an undefined value, which
usually indicates a programming error, either in your code or some
system code.
Null pointer is undefined.... '
i am using this code in a cfc file.
<cffunction name="MDArraySort" Returntype="query"
access="public" >
<cfargument name="colArray" type="array"
required="true">
<cfargument name="colNames" type="string"
required="true">
<cfargument name="colSort" type="string"
required="true">
<cfargument name="sensorIDs" type="string"
required="true">
<cfscript>
var tmpqry = Querynew(arguments.colNames);
var qRow = QueryAddRow(tmpqry, Arraylen(arguments.colArray)
</cfscript>
<cfloop from="1" to="#Arraylen(arguments.colArray)#"
index="qRowIndex">
<cfscript>
sIndexinSensorIDs = colArray[qRowIndex]["SENSOR"]&"##";
Temp_readin_code =
colArray[qRowIndex]["READING_CODE"]&"##";
QuerySetCell(tmpqry, 'SENSOR', sIndexinSensorIDs,
qRowIndex);
QuerySetCell(tmpqry,
'TYPE',javacast('String',colArray[qRowIndex]["TYPE"]), qRowIndex);
QuerySetCell(tmpqry, 'TIMESTAMP2',
LSParseDateTime(colArray[qRowIndex]["TIMESTAMP2"]), qRowIndex);
QuerySetCell(tmpqry,
'ORDER_BY_PARAM',javacast('String',colArray[qRowIndex]["ORDER_BY_PARAM"]),
qRowIndex);
QuerySetCell(tmpqry, 'READING_CODE',Temp_readin_code ,
qRowIndex);
QuerySetCell(tmpqry,
'READING',javacast('String',colArray[qRowIndex]["READING"]),
qRowIndex);
QuerySetCell(tmpqry,
'PK_READING',javacast('String',colArray[qRowIndex]["PK_READING"]),
qRowIndex);
QuerySetCell(tmpqry,
'ALARM_STATUS',javacast('String',colArray[qRowIndex]["ALARM_STATUS"]),
qRowIndex);
QuerySetCell(tmpqry, 'DURATION',
javacast('String',colArray[qRowIndex]["DURATION"]), qRowIndex);
QuerySetCell(tmpqry,
'DESCRIPTION',javacast('String',colArray[qRowIndex]["DESCRIPTION"]),
qRowIndex);
</cfscript>
</cfloop>
<cfquery name="qry" dbtype="query" >
SELECT *
FROM tmpqry
ORDER BY #arguments.colSort# ASC
</cfquery>
<cfreturn qry >
</cffunction>
It is working fine for some date range and and getting above
mentioned error in sone situation .Hi All ,
Thank you for your support ,
Finally i have fix the issue using some changes in my
function in cfc .
<cffunction name="MDArraySort" Returntype="query"
access="public" >
<cfargument name="colArray" type="array"
required="true">
<cfargument name="colNames" type="string"
required="true">
<cfargument name="colSort" type="string"
required="true">
<cfargument name="sensorIDs" type="string"
required="true">
<cfscript>
//Declare variable collection used in function as local
--->
var tmpqry =
Querynew(arguments.colNames,"CF_SQL_VARCHAR,CF_SQL_VARCHAR,CF_SQL_DATE,CF_SQL_VARCHAR,CF_ SQL_VARCHAR,CF_SQL_VARCHAR,CF_SQL_VARCHAR,CF_SQL_VARCHAR,CF_SQL_VARCHAR,CF_SQL_VARCHAR");
var qRow = QueryAddRow(tmpqry,
Arraylen(arguments.colArray));
</cfscript>
<cfloop from="1" to="#Arraylen(arguments.colArray)#"
index="qRowIndex">
<cfscript>
// Populate the query table
QuerySetCell(tmpqry, 'SENSOR',
colArray[qRowIndex]["SENSOR"], qRowIndex);
QuerySetCell(tmpqry,
'TYPE',arguments.colArray[qRowIndex]["TYPE"], qRowIndex);
QuerySetCell(tmpqry, 'TIMESTAMP2',
LSParseDateTime(arguments.colArray[qRowIndex]["TIMESTAMP2"]),
qRowIndex);
QuerySetCell(tmpqry,
'ORDER_BY_PARAM',arguments.colArray[qRowIndex]["ORDER_BY_PARAM"],
qRowIndex);
QuerySetCell(tmpqry, 'READING_CODE',
colArray[qRowIndex]["READING_CODE"] , qRowIndex);
QuerySetCell(tmpqry,
'READING',arguments.colArray[qRowIndex]["READING"], qRowIndex);
QuerySetCell(tmpqry,
'PK_READING',arguments.colArray[qRowIndex]["PK_READING"],
qRowIndex);
QuerySetCell(tmpqry,
'ALARM_STATUS',arguments.colArray[qRowIndex]["ALARM_STATUS"],
qRowIndex);
QuerySetCell(tmpqry, 'DURATION',
arguments.colArray[qRowIndex]["DURATION"], qRowIndex);
QuerySetCell(tmpqry,
'DESCRIPTION',arguments.colArray[qRowIndex]["DESCRIPTION"],
qRowIndex);
</cfscript>
</cfloop>
<cfquery name="qry" dbtype="query" >
SELECT *
FROM tmpqry
ORDER BY #arguments.colSort# ASC
</cfquery>
<cfreturn qry >
</cffunction>
Rajesh
SCMS
India -
How to declare a list of dates
Hi,
I have an item which type is "Display as text based on LOV". I put in the source section under the type "Pl/SQL function body" the following pl/sql function :
DECLARE
X VARCHAR2 (4000);
Y DATE ;
BEGIN
X := 'SELECT distinct(TO_CHAR(DATE1, ''YYYY'')) d, (TO_CHAR(DATE1, ''YYYY'')) r FROM SIVOA.EVV_'|| :p4_site ||' WHERE CLEF_VAR = (SELECT CLEF_VAR FROM SIVOA.SITE_DEBIT_RIVIERE WHERE SITE ='''|| :p4_site ||''')
order by d';
EXECUTE IMMEDIATE X INTO Y;
RETURN Y ;
END;The problem is that I get an ORA error.
ORA-00932: types de données incohérents ; attendu : - ; obtenu : -
I know that I have declared Y as a date and that what is returned by my function is a list of dates. I don't know how to declare a list of dates or whatever to be returned as a lis of values. Hope I am clear, sorry for my english.
Thank you for your kind help.
ChristianHi Tony
You hare very patient with me thank you !!!
Let me clarify well.
I am trying to create a list of values based on dates contained in a table. This list of values should contains the "years". If the table contains data for the years 2005, 2006, 2007, then the list of value should return :
2006
2007
2008
As I want a list of value I need to have a display and a return value. The name of the table is 'dynamic' It is the item P4_SITE that contains a part of the name of the table. This is why I am usins PL/SQL, because I don't know the name of the table in advance.
I have not seen any way to put a pl/sql statement in the List of values definition of the item. Thi s is why I try to make a LOV with the SOURCE of the item.
Hope I am clear.
Maybe you are looking for
-
PS and AI trouble verifying account-paid in full and seems active under managment
how come no matter how many times I quit my browser and clear my data will adobe not let me chat for support? I have paid in full for a PS and AI membership and keep getting warnings that there trouble verifying my account and it will stop working in
-
IBooks crashing on startup - crash report
I was downloading some books and ibooks crashed on me and will not start without immediately crashing. Here is the crash report. Process: iBooks [12899] Path: /Applications/iBooks.app/Contents/MacOS/iBooks Identifier: com.ap
-
Solaris 10 03/05HW1 fails to boot on HP BL25p
I have a problem with the above mentioned hardware. The installation succeeds from the install server. cpqary3 is installed as well as the disk size patch. When the machine reboots at the end of the install, the os doesn't load after configuration as
-
I'm in a bit of a mess with my printer. It wasn't working - whenever I tried to print (in Word), the job would stop before anything had actually been printed. I noticed that, when I chose 'Print' from the 'File' menu, there was a small exclamation ma
-
Hi! Having a problem with my alt gr button, works mostly like a usual alt-button xev says this when pressing alt gr: KeyPress event, serial 32, synthetic NO, window 0x1a00001, root 0x5c, subw 0x0, time 2826022020, (535,238), root:(719,445), state 0x0