Performance Query and transaction KO8G
Hi everybody, can u help me with a one problem?
I have a Query CO23, the query 2 months ago, worked perfectly, now the query never ends, I run in mode background , after that I need to run the transaction KO8G that 2 months ago worked perfectly, before the transaction run time was of 1 minute, today the run time is the fours hours, what can be the problem??
Code of CO23:
zamt_1 = 0.
zamt_2 = 0.
%z_0004 = 0.
select AUFKAUART AUFKAUFNR AUFKBUKRS AUFKOBJNR AUFK~WERKS
COVP~GJAHR
COVPKSTAR COVPLEDNR COVPOBJNR COVPORGVG COVP~PERIO
COVPVERSN COVPVRGNG COVPWERKS COVPWOGBTR COVP~WRTTP
AFIHAUFNR AFIHILOAN ILOA~ILOAN
into (AUFK-AUART , AUFK-AUFNR , AUFK-BUKRS , AUFK-OBJNR , AUFK-WERKS ,
COVP-GJAHR , COVP-KSTAR , COVP-LEDNR , COVP-OBJNR
, COVP-ORGVG , COVP-PERIO , COVP-VERSN , COVP-VRGNG , COVP-WERKS ,
COVP-WOGBTR , COVP-WRTTP , AFIH-AUFNR , AFIH-ILOAN
, ILOA-ILOAN )
from ( AUFK
inner join COVP
on COVPOBJNR = AUFKOBJNR
inner join AFIH
on AFIHAUFNR = AUFKAUFNR
inner join ILOA
on ILOAILOAN = AFIHILOAN )
where AUFK~AUART in zauart
and AUFK~AUFNR in zaufnr
and AUFK~BUKRS in zbukrs
and AUFK~WERKS in zwerks
and COVP~GJAHR in zgjahr
and COVP~KSTAR in zkstar
and COVP~LEDNR in zlednr
and COVP~PERIO in zperio
and COVP~VERSN in zversn
and COVP~WRTTP in zwrttp.
check zauart.
check zaufnr.
check zbukrs.
check zwerks.
check zgjahr.
check zkstar.
check zlednr.
check zperio.
check zversn.
check zwrttp.
amt_1 = 0.
amt_2 = 0.
if covp-orgvg0(2) = 'KO' or covp-vrgng0(2) = 'KO'.
Actuals Settlements
amt_2 = amt_2 + covp-wogbtr.
else.
Actuals
amt_1 = amt_1 + covp-wogbtr.
endif.
negocio = 'CABEZAS'.
if covp-werks = '5000'.
negocio = 'BLOCKS'.
endif.
%Z_0003 = AMT_1 + AMT_2 .
T01-AUART = AUFK-AUART.
T01-AUFNR = AUFK-AUFNR.
add AMT_1 to T01-AMT_1.
add AMT_2 to T01-AMT_2.
add %Z_0003 to T01-%Z_0003.
collect t01.
clear t01-AMT_1.
clear t01-AMT_2.
clear t01-%Z_0003.
ENDSELECT.
I did a new report with this code but is the same.
Regards
Thanks
Hi
Do not use SELECT .. ENDSELECT. Always download data to internal table and then loop at this internal table.
Instead of using COVP (which is a view and doesn't have any index) use tables COEP and COBK (if necessary). COEP has an index on the OBJNR field so the search will be faster.
I think this should do the trick. If not then we'll think of something else.
Rgds
Mat
Similar Messages
-
No flashback versions query and flashback transaction query tools on EM?
No Flashback Versions Query and Flashback Transaction Query tools on EM Console?
How to do Flashback Versions Query work and Flashback Transaction Query on EM Console?No Flashback Versions Query and Flashback Transaction
Query tools on EM Console?WOrks on mine.
How to do Flashback Versions Query work and Flashback
Transaction Query on EM Console?Part of the Maintenance , Recovery wizard. Not intended to be a casual query tool. -
How to in a transaction catch values of Query and use in another
hello, i have several dropboxes in a screen
the user select values and then press the button "Insert Data" ....at the first view could be an simple Sql Insert but before i have to do some sql queries with the values that the user select for example...in the first dropbox the user choose the area..but he see the area description and in the database have to go the area code...how can i make a Query and then catch the result to use in the insert Query...
another thing...how to call this transaction? i was thinking in put in the button..onclick , and build onefunction that call an transaction..it is possible??
regards
MárioMario,
taking the users input, use it to retrieve some more values and then do some database inserts sounds to me that you should use your "Insert Data" button to call a xacute query that gets the user input as parameter and calls a transaction that does the rest of the logic: prepare and execute the actual insert.
[SAP Help: Xacute Query|http://help.sap.com/saphelp_xmii120/helpdata/en/45/458160db273876e10000000a114a6b/frameset.htm]
Good luck
Michael -
Question about full backup and Transaction Log file
I had a query will taking full backup daily won't allow my log file to grow as after taking the full backup I still see the some of the VLF in status 2. It went away when I manually took the backup of log file. I am bit confused shall I
perform backup of transaction log and full database backup daily to avoid such things in future also until I run shrinkfile the storage space from server won't get reduced right.yes, full backup does not clear log file only log backup does. once the log backup is taken, it will set the inactive vlfs in the log file to 0.
you should perform log backup as the per your business SLA in data loss.
Go ahead and ask this to yourself:
If a disaster strikes and your database server is lost and your only option is restore it from backup,
how much data loss can your business handle??
the answer to this question is how frequently your log backup should be?
if the answer is 10 mins, you should have log backups every 10 mins atleast.
if the answer is 30 mins, you should have log backups every 30 mins atleast.
if the answer is 90 mins, you should have log backups every 90 mins atleast.
so, when you restore, you will restore latest fullbackup+differential(latest one taken after restored fullback)
and all the logbackups taken since the latest(restored full or differential backup).
there several resources on web,inculding youtube videos, that explain these concepts clearly.i advice you to look at them.
to release the file space to OS, you should the shrink the file. log file shrink happens from the end upto the point it reaches an active vlf.
if there are no inactive vlf's in the end,despite how many inactive vlf's the log file has in the begining, the log file is not shrinkable
Hope it Helps!! -
SAP R/3 Modules and transactions belonging to them.
Hello there,
I have two questions which I would like some help with:
Q1 Is there a link to documentation that lists all the SAP R/3 functional modules and provides an overview/description of each module?
Q2 I would like to list all the transactions belonging to a fuctional module/area such as SD, MM, PM, FI/CO etc. I know that tables TSTC & TSTCT will provide a list of all the transaction codes, but is there a table that will show all transaction codes belonging to a specific fuctional module?.. if not then is there another way of getting this information?...Please bear in mind that I need to be able to download this information to an excel spreadsheet.
Your help here would be much appreciated.
Many thanks
SharonHi williams,
>> For your query regarding SAP R/3 modules refer: http://en.wikipedia.org/wiki/SAP_R/3
>> For your query regarding Transaction codes refer:
http://www.easymarketplace.de/transactions.php
www.erpgenie.com/sapgenie/docs/useful-tcodes.pdf
Reward points if its useful... -
Initial Load Error - No generation performed. Call transaction GN_START
Hi Folks,
We are doing middleware configuration for data migration between R3->CRM.Have followed "Best Practies" configuration Guide.
System Using; CRM 2007 and ECC6.0
Issue
While performing initial load, system is throwing the error as
001- No generation performed. Call transaction GN_START
002-Due to system errors the Load is prohibited (check transaction MW_CHECK)!
After calling the transaction GN_START system asks for job scheduling,whereas I have already scheduled it.
A job is already scheduled periodically.
Clicking on 'Continue' will create another job
that starts immediately.
After checking(MW_CHECK),message is displayed as
No generation performed. Call transaction GN_START.
If anybody has encountered the similar issue and has resolved it,their guidence will be greatly appriciated.
Thanks in Advance
VEERA BVeera,
We also faced the same problem when we have done the upgrade from CRM 4.0 to CRM 2007.
For that you go to SMWP where you can see all the errors related to Middleware with the error message so try to remove the error,
Also pls check in RZ20 and activate the middleware trace tree.
Regards
Vinod -
Help in Ad-hoc query and Hr form editor
any body have material links of Ad-hoc query(it means how the reports are generated with Ad-hoc query) and Hr form editor(with examples) plz forward it to me???????????
Hi,
HR Ad Hoc Query is the special version of InfoSet Query with the HR object selection.
You can find the system documentation here:
http://help.sap.com/saphelp_erp2005vp/helpdata/en/f9/cc9138e4a0341fe10000009b38f8cf/frameset.htm
However I doubt the use of documentation of the query generator. So what is your concrete question?
Or in any R/3 via application help of transaction SQ01.
Also HR580 is a good course.
Regards,
Michael -
SAP BW QUERY AND BOBJ , QUERY VARIABLES
I have a SAP BW QUERY which Iu2019m trying to get through to BOBJ 4.0 AND CONTINUE TO GET THIS error "getDocumentInformation exception Error WRE 99998.........database error The MDX QUERY SELECT {...} ON CLOUMNS, NON EMPTY UNORDER, DIMESION PROPERTIES ON ROWS from SAP VARIABLES FAILED TO EXECUTE WITH ERROR for characteristic 0FISCYEAR, enter year in specified format(IES10901)
We using BOBJ 4.0 AND IDT TO CREATE connections to query...
In SAP BEX ANALYZER the query runs and returns results without any issues, but in u201CQUERY AS A WEB SERVICEu201D and u201CWEB SERVICEu201D we get THE above error ....
so i removed the variables from the row section and included it in the filter section of query and still i get errors in bobj (This is after going to Transaction RSRT checking the properties TAB and selecting "Use Selection of Structure Elements" and then generating query in SAP BW,
SOME queries you need to assign variable inputs for certain characteristics to restrict specific data ACCORDINGLY...
is there a way to come around this?
are there some docs available that simply describes the method of using a variable input/prompt in a SAP BW QUERY and how to use it in BOBJ?
Any help would be greatly appreciated
Thanks in Advancepersonal experience the variables doesnt work properly from query to bobj, remove any calculations in yoru query and variables, you could only use filters in query.. when you bring them in webi then brring the values to the report then create vraibles in it there.
i keep my query from filtering as well then do everything in webi or xcelsius .. -
Oracle 11g SE One Performance Monitoring and Tuning
I've recently "downgraded" a couple databases from Enterprise Edition to Standard Edition One and in doing so lost the use of Grid Control, specifically Performance Pack. Now, of course, monitoring and tuning, is a bit more cumbersome.
Can anyone offer advice on methods specific to Standard Edition One for monitoring/tuning databases? Specific SQL statements you use, 3rd party software, built-in packages in the database that can be used?There are a large number of performance views that can be queried, and if you capture the current values, wait a known amount of time (whether 1 minute or an hour) and then recapture the current values, you can determine by how much the statistics have changed over the time period. Do not query the views that begin with either "DBA_HIST_" or "DBA_ADVISOR_", since those views belong to the extra cost licenses that are only available with the Enterprise Edition (access to the views is audited).
You could, for instance, track the changes in the time model statistics, and use that as a basis to determine if anything else should be examined. It would probably also make sense to track the changes in the various non-idle wait events. If you have a Windows client PC, you can experiment with one of the scripts that I wrote which tracks changes to the time model statistics, changes to the OS statistics, and changes to the wait events:
http://hoopercharles.wordpress.com/2010/02/09/working-with-oracle%e2%80%99s-time-model-data-3/
If you do not have a Windows client PC, you might be able to determine how the script works and build your own solution.
Charles Hooper
Co-author of "Expert Oracle Practices: Oracle Database Administration from the Oak Table"
http://hoopercharles.wordpress.com/
IT Manager/Oracle DBA
K&M Machine-Fabricating, Inc. -
Transform sap query into transaction
hi!
my question is not related to mm but also not to other forums in this site.
i'm trying to transform sap query into transaction using se93 transaction.
i just learing sap in a class and we use an old version of sap.
user group name: ofer6
infoset name: ofer9
query name: ofer8
all created in global area
when i enter se93 i write t-code ZSTART and press "create".
then i choose: "transaction with parameters" in the popup window.
in the second screen i write the transaction ZSTART again.
i mark "skip initial screen" and "inherit gui attributes"
at the bottom of the page in "default values" i use the following:
D_SREPOVARI-EXTDREPORT OFER8
D_SREPOVARI-REPORT OFER6 G
D_SREPOVARI-REPORTTYPE AQ
when i press enter i get messages:
transaction ZSTART does not exist
Screen 0000 of program does not exist
The field D_SREPOVARI-REPORTTYPE does not exist on the called screen
The field D_SREPOVARI-REPORT does not exist on the called screenHi,
Please check the link below:
http://www.freesaptutorial.com/how-to-create-transaction-code-in-sap-using-se93/
Hope this will be helpful to you.
Thanks,
Neeraj -
Creating t.code for ABAP query and Transport it TO Production and run it .
Hi Friends
Thanks for ur reply ,
The requirement is that i want to create tcode for abap query and that query can be regenearted ,
in case of regeneration programe name i got answer programame name will be change, i created and modified query but i saw the same programe name ,,, may be it changed when it is trasnported if so then what ??
and also pls give me solution for asiging tcode for query which is going to be regenerated.
thanks and regards
farukhDear Farukh,
As we know,
Query is created in Production server and a corresponding program is generated by System.
What we have to do is just to assign the program to the desired transaction code in Development server and transport it.
If you have any doubts please let me know.
Kindly assign points if you find this info usefull.
Regards,
Lijo Joseph -
Example Of Aynchronous and Transactional RFC
hi all
please give me an <b>example for Aynchronous and Transactional RFC</b>.
<b>note: dont give me the definitions. </b>i have the same.please give me the example
regards
ravishHi Ravish,
I am using the FM RFC_READ_TABLE for the examples,
In our Examples we are using the following systems.
Description Server Name RFC Destination
Calling System PDC ENT Server NONE
Target System 1 PDC 210 Server PDC210
Target System 2 PDC ISU Server BPD150
<b>Common Code</b>
REPORT yarfc_with_resp_ran_test .
DATA : lit_options TYPE TABLE OF rfc_db_opt.
DATA : wa_options LIKE LINE OF lit_options.
DATA : lit_fields TYPE TABLE OF rfc_db_fld.
DATA : wa_fields LIKE LINE OF lit_fields.
DATA : lit_data TYPE TABLE OF tab512.
DATA : wa_data LIKE LINE OF lit_data.
DATA : lv_count TYPE i.
DATA : flg_check TYPE flag.
DATA : lv_time LIKE sy-uzeit.
CONSTANTS : lc_dbtable TYPE tabname VALUE 'MARA'.
*Refreshing the tables
REFRESH : lit_options,lit_fields,lit_data.
*Populating the Option Table
*Populating the Field Table
CLEAR wa_fields.
wa_fields-fieldname = 'MATNR'.
wa_fields-offset = 000032.
wa_fields-length = 000018.
wa_fields-type = 'C'.
wa_fields-fieldtext = 'Material number'.
APPEND wa_fields TO lit_fields.
<b>aRFC with Response</b>
* aRFC Example With Response
*Refreshing the Data Table
REFRESH : lit_data.
*PDC-ENT to PDC210
CALL FUNCTION 'RFC_READ_TABLE'
STARTING NEW TASK 'taskPDC210'
DESTINATION 'PDC210'
PERFORMING resp_pdc210 ON END OF TASK
EXPORTING
query_table = 'MARA'
TABLES
options = lit_options
fields = lit_fields
data = lit_data
EXCEPTIONS
table_not_available = 1
table_without_data = 2
option_not_valid = 3
field_not_valid = 4
not_authorized = 5
data_buffer_exceeded = 6
OTHERS = 7.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CLEAR lv_count.
lv_count = LINES( lit_data ).
WRITE : 'aRFC Example With Response'.
SKIP 1.
*MARA DB Count Before Receiving the result of Function Call
WRITE : 'MARA DB Count(PDC210)' , lv_count , sy-uzeit.
*Waiting for 1 Second to identify the time difference
WAIT UP TO 1 SECONDS.
*Synchronisation Point
WAIT UNTIL flg_check = 'X'.
SKIP 1.
WRITE : 'Time When We Set Flag Check i.e. we are in Receiving FM' , lv_time.
CLEAR lv_count.
lv_count = LINES( lit_data ).
SKIP 1.
*Waiting for 1 Second to identify the time difference
WAIT UP TO 1 SECONDS.
*MARA DB Count After Receiving the result of Function Call
WRITE : 'MARA DB Count(PDC210)' , lv_count , sy-uzeit.
*& Form resp_pdc210
FORM resp_pdc210 USING taskname.
RECEIVE RESULTS FROM FUNCTION 'RFC_READ_TABLE'
TABLES
options = lit_options
fields = lit_fields
data = lit_data
EXCEPTIONS
table_not_available = 1
table_without_data = 2
option_not_valid = 3
field_not_valid = 4
not_authorized = 5
data_buffer_exceeded = 6
OTHERS = 7
*Flag set for the Synchronisation Check.
flg_check = 'X'.
CLEAR lv_time.
*Time when flag get set.
lv_time = sy-uzeit.
ENDFORM. " resp_pdc210
<b>tRFC</b>
* Transactional RFC Example
*Refreshing the Data Table
REFRESH : lit_data.
*PDC-ENT to PDCISU
CALL FUNCTION 'RFC_READ_TABLE'
IN BACKGROUND TASK
DESTINATION 'PDCISU'
EXPORTING
query_table = lc_dbtable
TABLES
options = lit_options
fields = lit_fields
data = lit_data
EXCEPTIONS
table_not_available = 1
table_without_data = 2
option_not_valid = 3
field_not_valid = 4
not_authorized = 5
data_buffer_exceeded = 6
OTHERS = 7.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*Refreshing the Data Table
REFRESH : lit_data,lit_fields.
*Populating the Field Table
CLEAR wa_fields.
wa_fields-fieldname = 'INT_UI'.
wa_fields-offset = 000032.
wa_fields-length = 000022.
wa_fields-type = 'C'.
wa_fields-fieldtext = 'Internal key for point of delivery'.
APPEND wa_fields TO lit_fields.
*PDC-ENT to PDCISU
CALL FUNCTION 'RFC_READ_TABLE'
IN BACKGROUND TASK
DESTINATION 'PDCISU'
EXPORTING
query_table = 'EUIHEAD1'
TABLES
options = lit_options
fields = lit_fields
data = lit_data
EXCEPTIONS
table_not_available = 1
table_without_data = 2
option_not_valid = 3
field_not_valid = 4
not_authorized = 5
data_buffer_exceeded = 6
OTHERS = 7.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'RFC_PING'
IN BACKGROUND TASK
DESTINATION 'PDCISU'.
*Commit Work
COMMIT WORK.
<b>Do reply for any further help.</b>
Regards,
Ranjit Thakur.
<b>Please Mark The Helpful Answer.</b> -
Some Master and transaction loads taking long time in R/3 extraction andBW
Hi Experts,
We have some Master and transaction loads which takes long time in source system(R/3) in BW as well in daily process chains.These loads are happening in daily basis.
In Extraction ,they takes long duration to finish.
And then BW also takes much time.....
So pls give some suggestions ,by which we can reduce this duration....
And what can we do improve these loads perfomances......
your small suggestion can improve loads performance......
thanx in advance.....hi naveen,
go back and have a look at ur infopackage .. for the no of data packets it is picking up for each time ....
this can be done by going to scheduler in the menu and u can find the no of data packets and the size as well....
hope this works ...
snigdha >>> -
How to perform a WS-transaction between two webservices implemented in EJB3
Hello,
I would like to have an example of how to perform a WS-Transaction between two web services implemented with EJB 3.0. It should be done through code.
Thanks in advance.Bit a late answer, btu I don't like googling for somthing and founding open questions about the topic I search for.
Have a look at
http://jbossws.jboss.org/mediawiki/index.php?title=JAX-WS_User_Guide
and
http://soa.sys-con.com/node/39769
Cheers -
Working with a complex query and trying to get rid of duplicates
I'm working with the following complex query, and I need to
select vin, number, year, make, model, and state from
2007 vehicles in certain models, vin types
2006 vehicles in certain models, vin types
Is there a more efficient way to write this than how I've been writing it?:
select distinct vehicle.vin VIN, unit.STATION_ID STID, unit.EMBEDDED_AREA_CODE||unit.EMBEDDED_PREFIX||lpad(unit.EMBEDDED_RON,4,0)
MIN, unit.AUTHENTICATION_ID AUTHCODE, vehicle.user_veh_desc, veh_model.VEH_MODEL_DESC MODEL, veh_model.VEH_MANUF_YEAR YEAR, acct_veh.STATE STATE
from vehicle
inner join veh_unit on vehicle.vehicle_sak=veh_unit.vehicle_sak
inner join unit on veh_unit.unit_sak=unit.unit_sak
inner join vdu_profile on vdu_profile.vehicle_sak=vehicle.vehicle_sak
inner join vdu_profile_program on vdu_profile_program.VDU_PROFILE_SAK=vdu_profile.VDU_PROFILE_SAK
inner join veh_model on vehicle.VEH_MODEL = veh_model.VEH_MODEL
inner join acct_veh on acct_veh.VEHICLE_SAK = vehicle.VEHICLE_SAK
and vehicle.user_veh_desc like ('%2007%')
AND unit.unit_gen_id >= 36
AND vdu_profile_program.VDU_PROGRAM_SAK = 3
and vdu_profile_program.PREFERENCE_VALUE = 'Y'
and acct_veh.STATE in ('MN','ND','IA')
AND (veh_model.VEH_MODEL_DESC like ('%Vehicle2%')
OR veh_model.VEH_MODEL_DESC like ('%Vehicle3%')
OR veh_model.VEH_MODEL_DESC like ('%Vehicle5%')
OR veh_model.VEH_MODEL_DESC like ('%Vehicle6%')
OR veh_model.VEH_MODEL_DESC like ('%Vehicle7%')
OR veh_model.VEH_MODEL_DESC like ('%Vehicle8%')
OR veh_model.VEH_MODEL_DESC like ('%Vehicle9%'))
and ACCT_VEH.ACCT_VEH_STATUS_ID = 'A'
and (vehicle.vin like ('_______3_________')
or vehicle.vin like ('_______W_________')
or vehicle.vin like ('_______K_________')
or vehicle.vin like ('_______0_________'))
UNION
select distinct vehicle.vin VIN, unit.STATION_ID STID, unit.EMBEDDED_AREA_CODE||unit.EMBEDDED_PREFIX||lpad(unit.EMBEDDED_RON,4,0)
MIN, unit.AUTHENTICATION_ID AUTHCODE, vehicle.user_veh_desc, veh_model.VEH_MODEL_DESC MODEL, veh_model.VEH_MANUF_YEAR YEAR, acct_veh.STATE STATE
from vehicle
inner join veh_unit on vehicle.vehicle_sak=veh_unit.vehicle_sak
inner join unit on veh_unit.unit_sak=unit.unit_sak
inner join vdu_profile on vdu_profile.vehicle_sak=vehicle.vehicle_sak
inner join vdu_profile_program on vdu_profile_program.VDU_PROFILE_SAK=vdu_profile.VDU_PROFILE_SAK
inner join veh_model on vehicle.VEH_MODEL = veh_model.VEH_MODEL
inner join acct_veh on acct_veh.VEHICLE_SAK = vehicle.VEHICLE_SAK
and vehicle.user_veh_desc like ('%2006%')
AND unit.unit_gen_id >= 36
AND vdu_profile_program.VDU_PROGRAM_SAK = 3
and vdu_profile_program.PREFERENCE_VALUE = 'Y'
and acct_veh.STATE in ('MN','ND','IA')
AND (veh_model.VEH_MODEL_DESC like ('%Vehicle1%')
OR veh_model.VEH_MODEL_DESC like ('%Vehicle2%')
OR veh_model.VEH_MODEL_DESC like ('%Vehicle3%')
OR veh_model.VEH_MODEL_DESC like ('%Vehicle4%')
OR veh_model.VEH_MODEL_DESC like ('%Vehicle5%')
OR veh_model.VEH_MODEL_DESC like ('%Vehicle6%')
OR veh_model.VEH_MODEL_DESC like ('%Vehicle7%'))
and ACCT_VEH.ACCT_VEH_STATUS_ID = 'A'
and (vehicle.vin like ('_______Z_________')
or vehicle.vin like ('_______K_________'))I am not sure how many rows you have in the tables but I am assuming that there would be performance benefits in performing the query only once. You can combine similar coding and use an OR condition for the parts that are different. I left the 'K' vin comparison in both years for readability.
I was not able to fully test my code but I believe that it will work as is. I hope it helps. If you are happier with the UNION you may want to investigate the WITH clause as you can query a subset of data twice, rather than the full data set.
-- Common code
SELECT DISTINCT
vehicle.vin,
unit.station_id stid,
unit.embedded_area_code || unit.embedded_prefix || LPAD (unit.embedded_ron, 4, 0) MIN,
unit.authentication_id authcode,
vehicle.user_veh_desc,
veh_model.veh_model_desc model,
veh_model.veh_manuf_year YEAR,
acct_veh.state
FROM vehicle
INNER JOIN veh_unit
ON vehicle.vehicle_sak = veh_unit.vehicle_sak
INNER JOIN unit
ON veh_unit.unit_sak = unit.unit_sak
INNER JOIN vdu_profile
ON vdu_profile.vehicle_sak = vehicle.vehicle_sak
INNER JOIN vdu_profile_program
ON vdu_profile_program.vdu_profile_sak = vdu_profile.vdu_profile_sak
INNER JOIN veh_model
ON vehicle.veh_model = veh_model.veh_model
INNER JOIN acct_veh
ON acct_veh.vehicle_sak = vehicle.vehicle_sak
AND unit.unit_gen_id >= 36
AND vdu_profile_program.vdu_program_sak = 3
AND vdu_profile_program.preference_value = 'Y'
AND acct_veh.state IN ('MN', 'ND', 'IA')
AND acct_veh.acct_veh_status_id = 'A'
AND
-- Annual code
( -- 2006 conditions
AND vehicle.user_veh_desc LIKE ('%2007%')
AND regexp_like(veh_model.veh_model_desc, 'Vehicle[2356789]')
AND regexp_like(vehicle.vin, '_{7}[3WK0]_{9}')
OR
( -- 2007 conditions
AND vehicle.user_veh_desc LIKE ('%2006%')
AND regexp_like(veh_model.veh_model_desc, 'Vehicle[1234567]')
AND regexp_like(vehicle.vin, '_{7}[ZK]_{9}')
).
Maybe you are looking for
-
How to compress a .mov into a QuickTime for Internet sending?
My sequence exported as a .mov file is too big to send via YouSendit. I tried the Settings: QuickTime Compatible 7 in Compressor and the new file was 4.3 Size instead of 16.9. Same thing when I tried to compress it into an MPEG 4. I'm working on F
-
I currently have a 1Tb HDD installed in my macbook pro and have just recently acquired a 120GB SSD. I want to put the operating system on the SSD so it boots quickly but keep the files on the HDD. How do I do this?
-
MiniSAP tp problem - please help
Hi! I am trying to follow the Microsoft installation guidelines for installing the ADO.NET data provider for SAP. I have a miniSAP 4.6D system on Windows 2003. Some of the instuctions from Microsoft are below. Item 2 below (addtobuffer) worked fin
-
WD Java Scenarios on UIElements and TAble UIELement?
HI, Experts, I am new to WD Java i want to develop Scenarios based on more UIElements and another for using Table UIElement please farword me such documents or scenarios regarding this. Thank in advance, Shabeer Ahmed.
-
How to use my Canon MP540 with Lion Mountain
Hello i'm on Mountan Lion and i want to use my Printer, Canon MP540 but she is not so old and the system tell me.; We don't find any driver for your printer. Effectively only the 530 and the 560 are supported... Do you have any idea to work withe my