I have select query below and it is taking long time for only one org_id=83 only don't know why?
can you please help me on this? Please let me know if you need more details on this?
I am using Oracle 11.2.1 version.
SELECT a.customer_trx_id CUSTOMER_TRX_ID,
a.trx_number TRX_NUMBER,
Nvl(TL.sequence_num, 1)
TERM_SEQUENCE_NUMBER,
types.TYPE TRX_TYPE,
l_types.meaning TRX_TYPE_NAME,
TYPES.accounting_affect_flag
OPEN_RECEIVABLE_FLAG,
a.trx_date TRX_DATE,
ship_to_customer_id
SHIP_TO_CUSTOMER_ID,
ship_to_contact_id SHIP_TO_CONTACT_ID
,
remit_to_address_id
REMIT_TO_ADDRESS_ID,
A.primary_salesrep_id
PRIMARY_SALESREP_ID,
B.account_number CUSTOMER_NUMBER,
A.internal_notes INTERNAL_NOTES,
A.batch_source_id BATCH_SOURCE_ID,
A.comments TRX_COMMENTS,
previous_customer_trx_id
PREVIOUS_CUSTOMER_TRX_ID,
ship_to_site_use_id
SHIP_TO_SITE_USE_ID,
Nvl(printing_count, 0) PRINTING_COUNT,
printing_original_date
PRINTING_ORIGINAL_DATE,
printing_last_printed
PRINTING_LAST_PRINTED,
printing_pending PRINTING_PENDING,
last_printed_sequence_num
LAST_PRINTED_SEQUENCE_NUMBER,
start_date_commitment
START_DATE_COMMITMENT,
end_date_commitment
END_DATE_COMMITMENT,
initial_customer_trx_id
INITIAL_CUSTOMER_TRX_ID,
A.invoice_currency_code
INVOICE_CURRENCY_CODE,
A.term_id TERM_ID,
A.ship_date_actual SHIP_DATE_ACTUAL,
A.ship_via SHIP_VIA,
A.waybill_number WAYBILL_NUMBER,
A.purchase_order
PURCHASE_ORDER_NUMBER,
A.purchase_order_revision
PURCHASE_ORDER_REVISION,
A.purchase_order_date
PURCHASE_ORDER_DATE,
P.due_date
TERM_DUE_DATE_FROM_PS,
Nvl(TL.relative_amount, 100) * ( 100 / Nvl(T.base_amount, 100) )
TERM_RELATIVE_AMOUNT,
T.name TERM_NAME,
A.bill_to_customer_id
BILL_TO_CUSTOMER_ID,
A.bill_to_contact_id BILL_TO_CONTACT_ID
,
A.bill_to_site_use_id
BILL_TO_SITE_USE_ID,
U_BILL.location BILL_TO_LOCATION,
Nvl(A_BILL.translated_customer_name, PARTY.party_name) BILL_CUST_NAME,
Rtrim(Rpad(LOC.address1, 40)) BILL_ADDRESS1,
Rtrim(Rpad(LOC.address2, 40)) BILL_ADDRESS2,
Rtrim(Rpad(LOC.address3, 40)) BILL_ADDRESS3,
Rtrim(Rpad(LOC.address4, 40)) BILL_ADDRESS4,
LOC.city BILL_CITY,
Nvl(LOC.state, LOC.province) BILL_STATE,
LOC.postal_code BILL_POSTAL_CODE,
LOC.country BILL_COUNTRY,
U_BILL.tax_reference
BILL_SITE_TAX_REFERENCE,
PARTY.tax_reference
BILL_CUST_TAX_REFERENCE,
Nvl(amount_line_items_original, To_number(NULL)) TRX_LINE_AMOUNT,
Nvl(tax_original, To_number(NULL)) TRX_TAX_AMOUNT,
Nvl(freight_original, To_number(NULL)) TRX_FREIGHT_AMOUNT
,
p.amount_due_original
TRX_ALL_AMOUNT,
A.trx_number ORDER_BY,
LOC.address1 BILL_TO_ADDRESS1,
LOC.address2 BILL_TO_ADDRESS2,
LOC.address3 BILL_TO_ADDRESS3,
LOC.address4 BILL_TO_ADDRESS4,
LOC.state BILL_TO_STATE,
LOC.province BILL_TO_PROVINCE
FROM ar_adjustments COM_ADJ,
ar_payment_schedules P,
ra_cust_trx_line_gl_dist REC,
ra_customer_trx A,
hz_cust_accounts B,
ra_terms T,
ra_terms_lines TL,
ra_cust_trx_types TYPES,
ar_lookups L_TYPES,
hz_parties PARTY,
hz_cust_acct_sites A_BILL,
hz_party_sites PARTY_SITE,
hz_locations LOC,
hz_cust_site_uses U_BILL
WHERE A.bill_to_customer_id = B.cust_account_id
AND REC.customer_trx_id = A.customer_trx_id
AND REC.latest_rec_flag = 'Y'
AND REC.account_class = 'REC'
AND P.payment_schedule_id + Decode(P.class, 'INV', 0, '') = COM_ADJ.payment_schedule_id(+)
AND COM_ADJ.subsequent_trx_id IS NULL
AND 'C' = COM_ADJ.adjustment_type(+)
AND A.complete_flag = 'Y'
AND A.cust_trx_type_id = TYPES.cust_trx_type_id
AND L_TYPES.lookup_type = 'INV/CM/ADJ'
AND A.printing_option IN ( 'PRI', 'REP' )
AND L_TYPES.lookup_code = Decode(TYPES.TYPE, 'DEP', 'INV',
TYPES.TYPE)
AND Nvl(P.terms_sequence_number, Nvl(TL.sequence_num, 0)) =
Nvl(TL.sequence_num, Nvl(p.terms_sequence_number, 0))
AND Decode(P.payment_schedule_id, '', 0,
Nvl(T.printing_lead_days, 0)) = 0
AND A.bill_to_site_use_id = U_BILL.site_use_id
AND U_BILL.cust_acct_site_id = A_BILL.cust_acct_site_id
AND A_BILL.party_site_id = party_site.party_site_id
AND B.party_id = PARTY.party_id
AND loc.location_id = party_site.location_id
AND Nvl(LOC.LANGUAGE, 'US') = 'US'
AND Nvl(P.amount_due_remaining, 0) <> 0
AND A.term_id = TL.term_id(+)
AND A.term_id = T.term_id(+)
AND A.customer_trx_id = P.customer_trx_id(+)
AND A.printing_pending = 'Y'
AND Nvl(TL.sequence_num, 1) > Nvl(A.last_printed_sequence_num, 0)
AND Nvl(LOC.LANGUAGE, 'US') = 'US'
AND NOT EXISTS
(SELECT 'X'
FROM ece_tp_details ETD,
ece_tp_headers ETH
WHERE ETH.tp_header_id = A_BILL.tp_header_id
AND ETD.tp_header_id = ETH.tp_header_id
AND ETD.edi_flag = 'Y'
AND ETD.document_id = 'INO'
AND ETD.document_type = Decode (TYPES.TYPE, 'CM',Decode(A.previous_customer_trx_id, NULL, 'OACM', 'CM'), TYPES.TYPE))
UNION
SELECT a.customer_trx_id,
a.trx_number,
Nvl(P.terms_sequence_number, 1),
types.TYPE,
l_types.meaning,
TYPES.accounting_affect_flag,
a.trx_date,
A.ship_to_customer_id,
A.ship_to_contact_id,
A.remit_to_address_id,
A.primary_salesrep_id,
B.account_number,
A.internal_notes,
A.batch_source_id,
A.comments,
previous_customer_trx_id,
ship_to_site_use_id,
Nvl(printing_count, 0),
printing_original_date,
printing_last_printed,
printing_pending,
last_printed_sequence_num,
start_date_commitment,
end_date_commitment,
initial_customer_trx_id,
A.invoice_currency_code,
A.term_id,
A.ship_date_actual,
A.ship_via,
A.waybill_number,
A.purchase_order,
A.purchase_order_revision,
A.purchase_order_date,
P.due_date,
Nvl(TL.relative_amount, 100) * ( 100 / Nvl(T.base_amount, 100) ),
T.name,
A.bill_to_customer_id,
A.bill_to_contact_id,
A.bill_to_site_use_id,
U_BILL.location BILL_TO_LOCATION,
Nvl(A_BILL.translated_customer_name, PARTY.party_name) BILL_CUST_NAME,
Rtrim(Rpad(LOC.address1, 40)),
Rtrim(Rpad(LOC.address2, 40)),
Rtrim(Rpad(LOC.address3, 40)),
Rtrim(Rpad(LOC.address4, 40)),
LOC.city,
Nvl(LOC.state, LOC.province),
LOC.postal_code,
LOC.country,
U_BILL.tax_reference,
PARTY.tax_reference,
Nvl(amount_line_items_original, To_number(NULL)),
Nvl(tax_original, To_number(NULL)),
Nvl(freight_original, To_number(NULL)),
p.amount_due_original,
A.trx_number,
LOC.address1,
LOC.address2,
LOC.address3,
LOC.address4,
LOC.state,
LOC.province
FROM ra_terms_lines TL,
ra_cust_trx_types TYPES,
ar_lookups L_TYPES,
hz_cust_accounts B,
hz_parties PARTY,
hz_cust_site_uses U_BILL,
hz_cust_acct_sites A_BILL,
hz_party_sites PARTY_SITE,
hz_locations LOC,
ar_adjustments COM_ADJ,
ra_customer_trx A,
ar_payment_schedules P,
ra_terms T
WHERE A.bill_to_customer_id = B.cust_account_id
AND P.payment_schedule_id
+ Decode(P.class, 'INV', 0, '') = COM_ADJ.payment_schedule_id(+)
AND COM_ADJ.subsequent_trx_id IS NULL
AND 'C' = COM_ADJ.adjustment_type(+)
AND A.complete_flag = 'Y'
AND A.customer_trx_id = P.customer_trx_id
AND A.cust_trx_type_id = TYPES.cust_trx_type_id
AND L_TYPES.lookup_type = 'INV/CM/ADJ'
AND A.printing_option IN ( 'PRI', 'REP' )
AND L_TYPES.lookup_code = Decode(TYPES.TYPE, 'DEP', 'INV',TYPES.TYPE)
AND Nvl(T.printing_lead_days, 0) > 0
AND A.bill_to_site_use_id = U_BILL.site_use_id
AND U_BILL.cust_acct_site_id = A_BILL.cust_acct_site_id
AND A_BILL.party_site_id = PARTY_SITE.party_site_id
AND B.party_id = PARTY.party_id
AND LOC.location_id = PARTY_SITE.location_id
AND Nvl(LOC.LANGUAGE, 'US') = 'US'
AND Nvl(P.terms_sequence_number, TL.sequence_num) = TL.sequence_num
AND Nvl(P.amount_due_remaining, 0) <> 0
AND T.term_id = P.term_id
AND TL.term_id(+) = T.term_id
AND A.printing_pending = 'Y'
AND P.terms_sequence_number > Nvl(A.last_printed_sequence_num, 0)
AND Nvl(LOC.LANGUAGE, 'US') = 'US'
AND NOT EXISTS
(SELECT 'X'
FROM ece_tp_details ETD,
ece_tp_headers ETH
WHERE ETH.tp_header_id = A_BILL.tp_header_id
AND ETD.tp_header_id = ETH.tp_header_id
AND ETD.edi_flag = 'Y'
AND ETD.document_id = 'INO'
AND ETD.document_type = Decode (TYPES.TYPE, 'CM',Decode(A.previous_customer_trx_id,NULL, 'OACM','CM'),TYPES.TYPE))
Thank you!
I want to load an image from a URL.
I can load an image using this code:
local group = display.newGroup();
local testImg;
testImg = display.newImage( "cells/cellBottom.png");
group:insert( testImg );
but i need to use something like:
testImg = display.loadRemoteImage( "https://www.dropbox.com/s/fqlwsa5gupt5rsj/amcCells.png")
group:insert( testImg );
Please tell me how to load this image.
Cheers :)
Just use example given in Corona. This works with the following url but your url seems to have problem.
local function networkListener( event )
if ( event.isError ) then
print ( "Network error - download failed" )
else
event.target.alpha = 0
transition.to( event.target, { alpha = 1.0 } )
end
print ( "event.response.fullPath: ", event.response.fullPath )
print ( "event.response.filename: ", event.response.filename )
print ( "event.response.baseDirectory: ", event.response.baseDirectory )
end
display.loadRemoteImage( "http://coronalabs.com/images/coronalogogrey.png", "GET", networkListener, "coronalogogrey.png", system.TemporaryDirectory, 50, 50 )
try add yougroup:insert(event.target) in listener
local function networkListener( event )
if ( event.isError ) then
print ( "Network error - download failed" )
else
event.target.alpha = 0
transition.to( event.target, { alpha = 1.0 } )
**yourgroup:insert(event.target)**
end
print ( "event.response.fullPath: ", event.response.fullPath )
print ( "event.response.filename: ", event.response.filename )
print ( "event.response.baseDirectory: ", event.response.baseDirectory )
end
display.loadRemoteImage( "http://coronalabs.com/images/coronalogogrey.png", "GET", networkListener, "coronalogogrey.png", system.TemporaryDirectory, 50, 50 )
I have got a problem in running the blew program for reading a text file as input file. This input file is like a matrix with 3 columns -- 3 numbers with format of (3(F3.6,1x)) -- and 4368 rows.
The input file is:
602340.440000 129706.190000 28.892939
602340.880000 129706.390000 28.955128
602884.500000 128780.700000 29.876873
602884.380000 128781.190000 29.875114
602884.250000 128781.660000 29.885448
602884.130000 128782.150000 29.895996
602883.940000 128782.630000 29.899380
602883.810000 128783.120000 29.903221
602883.690000 128783.590000 29.907070
PROGRAM is:
USE BIEF
USE DECLARATIONS_TELEMAC2D
IMPLICIT NONE
INTEGER LNG,LU, ITRAC,I, NSOM,J, K, NDOWN
INTEGER, PARAMETER :: NLINE =4368
DOUBLE PRECISION, PARAMETER:: BATHY_RADIER_up= 29.84D0
DOUBLE PRECISION, PARAMETER:: DEPTH_up = 2.15D0
REAL :: A(5000),B(5000),C(5000)
DOUBLE PRECISION :: XPOLYD(14), YPOLYD(14), INPOLYD(14)
COMMON/INFO/LNG,LU
DOUBLE PRECISION XPOLY(6), YPOLY(6),COTE_RADIER_up
NSOM = 6
XPOLY(1) = 602883.13
XPOLY(2) = 602886.15
XPOLY(3) = 602887.15
XPOLY(4) = 602905.46
XPOLY(5) = 602902.52
XPOLY(6) = 602884.13
YPOLY(1) = 128779.99
YPOLY(2) = 128780.80
YPOLY(3) = 128777.12
YPOLY(4) = 128741.21
YPOLY(5) = 128739.75
YPOLY(6) = 128775.96
AT = 0.D0
CALL OS( 'X=0 ' , X=U )
CALL OS( 'X=0 ' , X=V )
IF(CDTINI(1:10).EQ.'COTE NULLE'.OR.
* CDTINI(1:14).EQ.'ZERO ELEVATION') THEN
CALL OS( 'X=C ' , H , H , H , 0.D0 )
CALL OS( 'X=X-Y ' , H , ZF , H , 0.D0 )
ELSEIF(CDTINI(1:14).EQ.'COTE CONSTANTE'.OR.
* CDTINI(1:18).EQ.'CONSTANT ELEVATION') THEN
CALL OS( 'X=C ' , H , H , H , COTINI )
CALL OS( 'X=X-Y ' , H , ZF , H , 0.D0 )
ELSEIF(CDTINI(1:13).EQ.'HAUTEUR NULLE'.OR.
* CDTINI(1:10).EQ.'ZERO DEPTH') THEN
CALL OS( 'X=C ' , H , H , H , 0.D0 )
ELSEIF(CDTINI(1:17).EQ.'HAUTEUR CONSTANTE'.OR.
* CDTINI(1:14).EQ.'CONSTANT DEPTH') THEN
CALL OS( 'X=C ' , H , H , H , HAUTIN )
ELSEIF(CDTINI(1:13).EQ.'PARTICULIERES'.OR.
* CDTINI(1:10).EQ.'PARTICULAR'.OR.
* CDTINI(1:07).EQ.'SPECIAL') THEN
NDOWN = 14
XPOLYD(1) = 602883.13
XPOLYD(2) = 602886.15
XPOLYD(3) = 602864.47
XPOLYD(4) = 602837.90
XPOLYD(5) = 602821.91
XPOLYD(6) = 602649.77
XPOLYD(7) = 602634.35
XPOLYD(8) = 602345.08
XPOLYD(9) = 602326.07
XPOLYD(10) = 602619.31
XPOLYD(11) = 602638.33
XPOLYD(12) = 602811.64
XPOLYD(13) = 602831.52
XPOLYD(14) = 602857.16
YPOLYD(1) = 128779.99
YPOLYD(2) = 128780.80
YPOLYD(3) = 128867.74
YPOLYD(4) = 128936.74
YPOLYD(5) = 128953.95
YPOLYD(6) = 129105.43
YPOLYD(7) = 129143.43
YPOLYD(8) = 129713.38
YPOLYD(9) = 129708.26
YPOLYD(10) = 129136.41
YPOLYD(11) = 129094.72
YPOLYD(12) = 128941.16
YPOLYD(13) = 128931.09
YPOLYD(14) = 128865.81
PRINT *, 'opening file'
DO 10 J=1,NPOIN
IF(INPOLY(X(J),Y(J),XPOLY,YPOLY,NSOM)) THEN
PRINT *, 'upstream area'
H%R(J)=MAX(0.D0,COTE_RADIER_up-ZF%R(J))
U%R(J)=0.0D0
PRINT *, 'upstream area'
write(lu,*) 'upstream ....',J,H%r(J)
ELSE
IF(INPOLY(X(J),Y(J),XPOLYD,YPOLYD,NDOWN)) THEN
OPEN(unit =90, FILE = 'cunnette_xyz.txt', FORM='FORMATTED')
PRINT *, 'downstream area'
READ(90,*) A(K),B(K),C(K)
PRINT *, 'already read'
DO K=1,NLINE
PRINT *, "number of lines read:", NLINE
IF(A(K).EQ.X(J).AND.B(K).EQ.Y(J)) then
PRINT *, 'Nodes are inside'
H%R(K)=0.45D0
U%R(K)=0.D0
ELSE
H%R(K)=0.0D0
U%R(K)=0.0D0
ENDIF
ENDDO
CLOSE(90)
ENDIF
ENDIF
10 CONTINUE
ELSE
IF(LNG.EQ.1) THEN
WRITE(LU,*) 'CONDIN : CONDITION INITIALE NON PREVUE : ',CDTINI
ENDIF
IF(LNG.EQ.2) THEN
WRITE(LU,*) 'CONDIN: INITIAL CONDITION UNKNOWN: ',CDTINI
ENDIF
STOP
ENDIF
IF(NTRAC.GT.0) THEN
DO ITRAC=1,NTRAC
CALL OS( 'X=C ' , X=T%ADR(ITRAC)%P , C=TRAC0(ITRAC) )
ENDDO
ENDIF
CALL OS( 'X=C ' , VISC , VISC , VISC , PROPNU )
RETURN
END
The error message when running is:
at line read file: Fortran runtime error: End of file.
My last output is 'downstream area' aftre open Command. Could anybody help me please?
First of all, you are opening the file repeatedly for every value of J. This seems wrong.
Secondly, you have not given the variable NPOIN a value (greater than 1), so your outer loop on J will not stop running (I guess), and this will eventually lead to you trying to read beyond the end of file.
You have nested loops, one on J and one on K, which seems not logical. You should have one only.
Open the file outside of the J loop, and then read line per line until you reach the end of the file:
INTEGER :: Reason
INTEGER :: NPOIN
OPEN(unit =90, IOSTAT=Reason, FILE = 'cunnette_xyz.txt', FORM='FORMATTED')
IF (Reason > 0) THEN
* ... something wrong ...
PRINT *, 'Error opening file'
STOP
END IF
NPOIN = 0
DO
NPOIN = NPOIN + 1
READ(*,*, IOSTAT=Reason) A(NPOIN), B(NPOIN), C(NPOIN)
IF (Reason > 0) THEN
PRINT *, 'Error reading input from file. Aborted'
STOP
ELSE IF (Reason < 0) THEN
* ... end of file reached ...
NPOIN = NPOIN - 1
PRINT *, 'All data read from file'
EXIT
END IF
END DO
* All input should be in A, B, C arrays now, with NPOIN entries
DO K=1, NPOIN
* Your processing comes here. No more file I/O.
END DO