SQL Commands - uncheck autocommit hangs
If i uncheck the 'Autocommit' flag in the SQL Commands page and execute any command, it hangs (even for a simple select statement).
Is this a known problem ?
Database parameter job_queue_processes must be set to a number > 0. See "Managing JOB_QUEUE_PROCESSES" in the Installation Guide.
Scott
Similar Messages
-
Autocommit inside one SQL command
Hi,
I have 2 tables A and B each have two columns id and name. I used "update A set A.name = (Select B.name from B where A.id=B.id)" to update table A's name. However, when both tables are very large( say 5M rows), Since Oracle will commit only after a command, so, the DB will hold the 5M rows in the rollback segments, if the rollback segments are not large enough, the updating will be very slow. Is there any way to let Oracle commit inside one SQL command? For exemple, auto commit after every 10000 rows get updated.
Thanks.Thanks for your comments. We have done some tests:
1. We used a flag to limit the number of rows for updating in 2000, 5000, 10000 and 50000 rows. We found that the time/rows in 2000 rows was much lower than in 50000 rows. The higher the testing rows, the higher time/rows was.
2. We used single SQL (update ... select .. from) command to update whole table vs used one select SQL and a seperate update SQL to update table A one record by one record using Java. I thought first one should be much fast than second one. But there were not big diferrence.
Do you have any ideal for tuning this DML?
Thanks. -
SQL Command problem in Application Express 3.2.0.00.27
To Oracle Application Express Development Team,
Yesterday I installed Oracle Application Express 3.2.0.00.27.
While doing my r&d, I came across one problem in SQL Command.
For example I wanted to run sql "select * from tab"
When I checked "Autocommit" checkbox it worked fine.
But when I unchecked the "Autocommit" checkbox it gave me following error:
ORA-01003: no statement parsed
Please check post
http://www.oraclebrains.com/2009/03/sql-command-problem-in-application-express-3200027/ for more details.
CheersI can't find the log file (a good indication that something went wrong)
Here's the transcript of the session...
SQL> startup upgrade
ORACLE instance started.
Total System Global Area 599785472 bytes
Fixed Size 1288820 bytes
Variable Size 264242572 bytes
Database Buffers 331350016 bytes
Redo Buffers 2904064 bytes
Database mounted.
Database opened.
SQL> @apxpatch.sql
PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
Wrote file apxset.sql
PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
SQL>
SQL> @apxldimg.sql
PL/SQL procedure successfully completed.
Enter value for 1: C:\Documents and Settings\jtench\Desktop\My Downloads\Oracle\apex_3.2.1
old 1: create directory APEX_IMAGES as '&1/apex/images'
new 1: create directory APEX_IMAGES as 'C:\Documents and Settings\jtench\Desktop\My Downloads\Oracle\apex_3.2.1/apex/images'
Directory created.
PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
Commit complete.
timing for: Load Images
Elapsed: 00:03:30.03
Directory dropped.
SQL> -
Possible to change the datasource from a business-view to a Sql Command ?
Hello,
When a business view contains a lot of elements it takes a while just to open the report.
We'd like to keep the BV as the dictionnary, but,
once the report design completed,
we'd like to disconnect the business view and replace it by the Sql command which can be seen in the menu option 'show SQL query'.
Is it possible via the RAS sdk ?
Did somebody experience this ?
How to proceed ?
Thanks a lot
AlainHi Ted,
I'm thinking opening a Case for this problem of opening reports based on a big BV.
We can't really reduce the BV, since it is the dictionnary and we need the whole thing...
I'm wondering why it is impossible to change the Datasource if the tables and fields underneath are identical.
Is it impossible to change the fields' mapping ?
The other solution, as you suggest, is to create a report from scratch, create a new Datasource with the Sql command format, and rebuild the report... I agree it looks like a big job...
Do you know if it is possible to export the report in XML for instance, change the XML, and then re-import ?
Thanks for your Help.
Alain -
using apex 4.1 i'm entering the following query in the sql command window and I keep getting a pop-up for Entering Bind Variable. I'm not using bind variables though, anyone else see this issue before?
SELECT A.FIRST,A.LAST,A.COMPANY AS CNAME,
J.TOT_MAN_HOURS,
J.ACREAGE,
W.NUM_WORKERS,
W.START_DT
FROM EW_ACCOUNTS A, EW_WORK_ORDER W, EW_JOBS J
WHERE A.ID = J.ACCT_ID
AND J.JOB_ID = W.JOB_ID
AND W.START_DT >= SYSDATE
AND W.START_DT < SYSDATE+1
ORDER BY W.START_DTI tried that and it didn't seem to help either.
Funny though, if I write a new query against just one of the tables and write out each column name. it works. If I use the * instead of writing each column name, I have the same issue.
This is in apex.appshosting.com free demo environment. I sent them an email asking about it and they told me it was a code issue and they don't support the demo environment. -
Hello,
As part of my report I populate a table then reference it in several following subreports.
The issue I'm having is that I need to clear all the data from my table after using it to allow the report to run again (and not get multiple results)
To do this I have tried to add a sub report at the very end (and start) of my report with the SQL command truncate table <tablename> or delete <tablename> or delete <tablename> where 1 = 1.
When I try truncate I get an error saying that I don't have permission (despite granting it but hey...) which is why I switched to delete, this runs fine but the table doesn't get deleted...
Any thoughts as to why this isn't working/how I can clear my table? I have thought of setting up a separate scheduled job to delete the table contents however I do also need to run the report several times with different parameters so this isn't an ideal solution.
I have tried adding a select after my delete statement as I thought if it had something to display on the report it would have to look at it but this didn't make any difference.
Any help will be much appreciated!
Thanks
ChrisThanks for that!
I have had a go at this and I can see how it will work although I have limited access on the Crystal userid I have so will need to have the SP created as part of our nightly refresh script I think.
Is there no way of getting crystal to run my delete statement otherwise?
Thanks again
Chris -
Crystal Report performance - subreports or sql command?
Hello,
bit of quandary, I've an existing report that contains six subreports all sharing the same parameter to the main report, a 'projectID' field.
The main report approximately returns 300 records/projects and each of the 6 subreports are passed the corresponding 'projectID' field 300 times.
Now, I've succesfully incorporated the main report query and corresponding subreports into a TSQL command containing a number of subqueries in the Select clause:
SELECT PROJECT.PROJECTID, PROJECT.TITLE, PROJECT.REFERENCE, PROJECTSTATUS.PROJECTSTATUS, PROJECT.INPUT_DATE
,(SELECT max(INPUT_DATE) FROM V_PROJECT_NOTE AS VPN
WHERE PROJECT.PROJECTID = VPN.PROJECTID) AS LastHeadline
,(SELECT
MAX(CASE
WHEN MODIFIED_DATE IS NULL THEN INPUT_DATE
WHEN INPUT_DATE > MODIFIED_DATE THEN INPUT_DATE
ELSE MODIFIED_DATE
END) FROM ISSUE WHERE PROJECT.PROJECTID = ISSUE.PROJECTID) AS LastNewIssue
,(SELECT max(ISSUENOTE.INPUT_DATE) FROM ISSUE
INNER JOIN ISSUENOTE ON ISSUE.ISSUEID = ISSUENOTE.ISSUEID
WHERE PROJECT.PROJECTID = ISSUE.PROJECTID ) AS LastIssueNote
,(SELECT max(modified_date) FROM V_PROJECT_RISK_LAST_AMMENDED AS VPR
WHERE PROJECT.PROJECTID = VPR.PROJECTID) AS LastRiskLogUpdate
,(SELECT max(INPUT_DATE) FROM PROJECT_CHECKLIST AS PC
WHERE PROJECT.PROJECTID = PC.PROJECTID) AS LastChecklistUpdate
,(SELECT max(input_date) FROM V_PROJECT_ACTIVITY_LAST_AMMENDED AS VPA
WHERE PROJECT.PROJECTID = VPA.PROJECTID) AS LastGANTTUpdate
,V_PROJECT_KEYCONTACT.USERNAME AS KeyContact
,(SELECT USERPROFILE.USERNAME AS Supervisor
FROM USERPROFILE INNER JOIN
PROJECT_MEMBER AS SUPERVISOR ON USERPROFILE.USERID = SUPERVISOR.USERID RIGHT OUTER JOIN
PROJECT_MEMBER AS KEYCONTACT ON SUPERVISOR.PROJECT_MEMBERID = KEYCONTACT.PARENTID
WHERE PROJECT.PROJECTID = KEYCONTACT.PROJECTID
AND KEYCONTACT.KEY_CONTACT =1) AS Supervisor
FROM PROJECT INNER JOIN
PROJECTSTATUS ON PROJECT.PROJECTSTATUSID = PROJECTSTATUS.PROJECTSTATUSID LEFT OUTER JOIN
V_PROJECT_KEYCONTACT ON PROJECT.PROJECTID = V_PROJECT_KEYCONTACT.PROJECTID
WHERE V_PROJECT_KEYCONTACT.USERNAME IN ('aaa','bbb','ccc')
AND (PROJECTSTATUS.PROJECTSTATUS IN ('111', '222', '333'))
AND ((PROJECT.TITLE NOT LIKE 'xxx%') AND (PROJECT.TITLE NOT LIKE 'yyy%') AND (PROJECT.TITLE NOT LIKE 'zzz%'))
ORDER BY V_PROJECT_KEYCONTACT.USERNAME, PROJECT.INPUT_DATE
Now, I've run both SQL Server Profiler and looked at the Performance Information in Crystal and the SQL command method is an order of magnitude less efficient!!
I may have to post my query on a TSQL forum but was wondering if anyone on here can possible shed any light on it?
Thanks in advance,
DomDom,
I assume that the last edit was to remove a few curse words...
The reality is that we can give a good explanation as to why the sub-report version would execute faster that the command version w/o seeing the report (with the sub-reports included).
Looking at the SQL, I can tell that it's a fairly expensive query, firing several sub-queries for every row returned by the outer query. That said, I sounds like the same thing is taking place with the sub-report version too... So I would think that the performance would be similar.
The only thing that I can think of, and this is just a guess... With the sub-report version, each all queries are being run independently and then combined locally by CR, whereas the command version, everything is combined. The more complex the query, the harder the optimizer has to work to come up with the best execution plan... and the greater the likelihood that that the resulting plan isn't as optimized as it could be.
That said, I'd still think the command version would be faster over all. Are you seeing real differences between the two reports, in the amount of time that it takes from refresh to final render?
Either way, I think moving all of those sub-queries from the select list (where they are executing once for every row) down to the FROM area (where they only have to execute once) should increase the speed dramatically and surpass the sub-report version by a decent margin.
Give this version of your SQL a test drive and see if it yields an improvement.
SELECT
PROJECT.PROJECTID,
PROJECT.TITLE,
PROJECT.REFERENCE,
PROJECTSTATUS.PROJECTSTATUS,
PROJECT.INPUT_DATE,
VPN.LastHeadline,
ISSUE.LastNewIssue,
ISSUE_NOTE.LastIssueNote,
VPR.LastRiskLogUpdate,
PC.LastChecklistUpdate,
VPA.LastGANTTUpdate,
V_PROJECT_KEYCONTACT.USERNAME AS KeyContact,
Supervisor.Supervisor
FROM PROJECT
INNER JOIN PROJECTSTATUS ON PROJECT.PROJECTSTATUSID = PROJECTSTATUS.PROJECTSTATUSID
LEFT OUTER JOIN V_PROJECT_KEYCONTACT ON PROJECT.PROJECTID = V_PROJECT_KEYCONTACT.PROJECTID
LEFT OUTER JOIN (
SELECT PROJECTID,
max(INPUT_DATE) AS LastHeadline
FROM V_PROJECT_NOTE
GROUP BYPROJECTID) AS VPN ON PROJECT.PROJECTID = VPN.PROJECTID
LEFT OUTER JOIN (
SELECT PROJECTID,
MAX(CASE
WHEN MODIFIED_DATE IS NULL THEN INPUT_DATE
WHEN INPUT_DATE > MODIFIED_DATE THEN INPUT_DATE
ELSE MODIFIED_DATE END) AS LastNewIssue
FROM ISSUE
GROUP BY PROJECTID) AS ISSUE ON PROJECT.PROJECTID = ISSUE.PROJECTID
LEFT OUTER JOIN (
SELECT ISSUE.PROJECTID,
max(ISSUENOTE.INPUT_DATE) AS LastIssueNote
FROM ISSUE
INNER JOIN ISSUENOTE ON ISSUE.ISSUEID = ISSUENOTE.ISSUEID
GROUP BY ISSUE.PROJECTID) AS ISSUE_NOTE ON PROJECT.PROJECTID = ISSUE_NOTE.PROJECTID
LEFT OUTER JOIN (
SELECT PROJECTID,
max(modified_date) AS LastRiskLogUpdate
FROM V_PROJECT_RISK_LAST_AMMENDED
GROUP BY PROJECTID) AS VPR ON PROJECT.PROJECTID = VPR.PROJECTID
LEFT OUTER JOIN (
SELECT PROJECTID,
max(INPUT_DATE) AS LastChecklistUpdate
FROM PROJECT_CHECKLIST
GROUP BY PROJECTID) AS PC ON PROJECT.PROJECTID = PC.PROJECTID
LEFT OUTER JOIN (
SELECT PROJECTID,
max(input_date) AS LastGANTTUpdate
FROM V_PROJECT_ACTIVITY_LAST_AMMENDED
GROUP BY PROJECTID) AS VPA ON PROJECT.PROJECTID = VPA.PROJECTID
LEFT OUTER JOIN (
SELECT PROJECTID,
USERPROFILE.USERNAME AS Supervisor
FROM USERPROFILE
INNER JOIN PROJECT_MEMBER AS SUPERVISOR ON USERPROFILE.USERID = SUPERVISOR.USERID RIGHT
OUTER JOIN PROJECT_MEMBER AS KEYCONTACT ON SUPERVISOR.PROJECT_MEMBERID = KEYCONTACT.PARENTID
WHERE KEYCONTACT.KEY_CONTACT =1) AS Supervisor ON PROJECT.PROJECTID = Supervisor.PROJECTID
WHERE V_PROJECT_KEYCONTACT.USERNAME IN ('aaa','bbb','ccc')
AND (PROJECTSTATUS.PROJECTSTATUS IN ('111', '222', '333'))
AND ((PROJECT.TITLE NOT LIKE 'xxx%')
AND (PROJECT.TITLE NOT LIKE 'yyy%')
AND (PROJECT.TITLE NOT LIKE 'zzz%'))
ORDER BY V_PROJECT_KEYCONTACT.USERNAME, PROJECT.INPUT_DATE
HTH,
Jason -
Query running on sql commands prompt not running on report region
Hi All,
Facing a weird issue now. I have written a report query which is running absolutely fine in sql command prompt but when i trying to run this as a report it is just processing and the report is not loading. What could be the reason behing this?
Thanks in Advance
RegardsHi,
With no other information about the problem is hard to know what's happening. If you could at least provide us with the query then I think it would be easier for us to help you.
Regards,
Sergio -
"Between NVL" - Works in SQL Command, not in APEX report region
First, I realize I could use dynamic SQL (model 4), but I don't want to (too hard just yet).
I have a select statement with a series of Where conditions that employ values, in bind variables, supplied by the user.
I want the choice of parameters to be optional, so I am checking for and replacing nulls.
Select emp_name from employee_table where
emp_rating between nvl(:p7_rating_choice, 0) and nvl(:p7_rating_choice, 99)
and
emp_language_no between nvl(:p7_lang_choice, 0) and nvl(:p7_lang_choice, 99);
(the binds should be numeric).
The actual statement is quite a bit longer, but the point is that the BETWEEN NVL(:x, min) AND NVL(:x, max) piece does not seem to work when used in a report region.
It works fine if ALL parameters are provided, but returns an error if one or more are null.
In the SQL command window it works (with a pop-up) just fine.
By the way, the :p7_lang_choice bind variable is chosen from a LOV list which works in all other cases.
Also, if I disable nulls (choosing "no" in ITEM page), everything works fine. It seems that the substitution of the min and max values via the NVL returns the wrong data type.
Any ideas what I have done wrong?Thanks Scott.
Every day brings a little more understanding!
I also noticed a simplified method in the APEX documentation (although there was no explanation of the code) as follows:
Where
(column = :p1_user_input_1 OR :p1_user_input_1 = [null substitution value])
AND
(column = :p1_user_input_2 OR :p1_user_input_2 = [null substitution value])
AND
etc...
Using the value you provide in the LOV section for the null, the second part of the OR handles the null situation.
For some reason I was so tied up with comparing to the column that I never thought to have an OR with a compare to something else.
Oh well.
Thanks,
Norm -
Without using SubReport or SQL Command in Main Report, get desired results without duplicating
It seems so simple. I just need the cost, at a certain time (based on a parameter), for each item. I wrote a SQL Command that works beautifully, but when it connects to the existing report, it slows to a horrible crawl and cannot be used for tables with over 4 million records. Here is the SQL Command that provides the desired results:
SELECT TOP 1 WITH TIES "INVENTITEMPRICE"."ITEMID", "INVENTITEMPRICE"."PRICETYPE", "INVENTITEMPRICE"."MARKUP", "INVENTITEMPRICE"."PRICEUNIT", "INVENTITEMPRICE"."PRICE", "INVENTITEMPRICE"."PRICEQTY", "INVENTITEMPRICE"."ACTIVATIONDATE", "INVENTITEMPRICE"."DATAAREAID"
FROM ("AX09PROD"."dbo"."INVENTITEMPRICE" "INVENTITEMPRICE" INNER JOIN "AX09PROD"."dbo"."INVENTTABLE" "INVENTTABLE" ON (("INVENTITEMPRICE"."ITEMID"="INVENTTABLE"."ITEMID") AND ("INVENTITEMPRICE"."DATAAREAID"="INVENTTABLE"."DATAAREAID")))
WHERE ("INVENTITEMPRICE"."DATAAREAID"=N'TMC' AND "INVENTITEMPRICE"."PRICETYPE"=0 AND "INVENTITEMPRICE"."ACTIVATIONDATE"<={?As Of Date})
ORDER BY ROW_NUMBER () OVER(PARTITION BY "INVENTITEMPRICE"."ITEMID" ORDER BY "INVENTITEMPRICE"."ACTIVATIONDATE" DESC)
I've attached the report with saved data. However, when I remove the restrictions of just certain items, it is unusable as it is SO SLOW!
I can also get the desired results from using a subreport but it takes forever to export due to the number of records/items. Whenever possible, I avoid subreports for this reason. I've attached that report with data as well.
Please be patient as I'm not savvy in SQL, but decent in generating reports. What am I doing wrong? This seems SO simple. The premise is that I want the corresponding information based on the date entered: If the date entered is 3/15/2014, the result should be 91.15 as indicated below. I'd simply like this value to be placed in a formula per item.
Item 80014:
Activation Date
Cost Price
6/2/2014
104.43
4/1/2014
91.58
3/1/2014
91.15
2/1/2014
92.89
1/1/2014
93.57
Any assistance would be GREATLY appreciated!
Thanks!
Teena
Update: I was unable to attach the reports with .rpt or .txt extensions. There were well under 1MB. Any suggestions?hi Teena,
if you're going the inline subquery route, try something like the following...the last line in the sub-query 'where' clause should in theory take care of matching the correct price based on relating the item id's between your cost price & inventory data. this should leave you with distinct values for each itemid then. hopefully it won't error out as i'm just guessing on the syntax.
SELECT DISTINCT
"INVENTTABLE"."ITEMID",
"INVENTTRANS"."DATAAREAID",
"INVENTTRANS"."DATEPHYSICAL",
"INVENTTRANS"."QTY",
"INVENTTABLE"."ITEMGROUPID",
"INVENTTABLE"."ITEMNAME",
"INVENTTRANS"."TRANSREFID",
"INVENTTRANS"."STATUSISSUE",
"INVENTTABLE"."ITEMTYPE",
"INVENTTRANS"."TRANSTYPE",
"INVENTTRANS"."RECID",
"INVENTTRANS"."DIRECTION",
SELECT TOP 1 "INVENTITEMPRICE"."PRICE"
FROM "AX09PROD"."dbo"."INVENTITEMPRICE" "INVENTITEMPRICE"
WHERE "INVENTITEMPRICE"."DATAAREAID" LIKE 'TMC%'
AND "INVENTITEMPRICE"."PRICETYPE"=0
AND "INVENTITEMPRICE"."ACTIVATIONDATE"<={?As Of Date}
AND "INVENTITEMPRICE"."ITEMID" = "INVENTTABLE"."ITEMID"
ORDER BY "INVENTITEMPRICE"."ACTIVATIONDATE" DESC
) AS ITEMPRICE
FROM
"AX09PROD"."dbo"."INVENTTABLE" "INVENTTABLE"
LEFT OUTER JOIN "AX09PROD"."dbo"."INVENTTRANS" "INVENTTRANS"
ON ("INVENTTABLE"."DATAAREAID"="INVENTTRANS"."DATAAREAID")
AND ("INVENTTABLE"."ITEMID"="INVENTTRANS"."ITEMID")
WHERE
"INVENTTRANS"."DATAAREAID" LIKE 'TMC%'
AND (("INVENTTABLE"."ITEMGROUPID" LIKE 'RAW%') OR ("INVENTTABLE"."ITEMGROUPID" BETWEEN '000' AND '999') OR ("INVENTTABLE"."ITEMGROUPID" LIKE 'Ship_Box'))
AND "INVENTTABLE"."ITEMTYPE" IN (0,1)
ORDER BY
"INVENTTABLE"."ITEMGROUPID",
"INVENTTABLE"."ITEMID",
"INVENTTRANS"."DATEPHYSICAL" ASC
Message was edited by: Jamie Wiseman -
Problem creating a SQL command object and adding it to a Crystal report
Hi,
I'm trying to add the following SQL command object with the following sql for MYSQL 5.1
SELECT lic.id, lic.productionname, comp.companyname, lic.paymentreceiveddate, lic.licenseissuedate,
IFNULL((SELECT sum(licsong.feequoted) from licensesong licsong where licsong.licenseid = lic.id), 0) as totalfeequoted,
IFNULL((SELECT sum(licsong.feetax) from licensesong licsong where licsong.licenseid = lic.id), 0) as totalfeetax,
IFNULL((SELECT sum(licsong.feequoted + licsong.feetax) from licensesong licsong where licsong.licenseid = lic.id), 0) as totalfee,
IFNULL((SELECT sum(pay.fullamount) from payment pay where pay.licenseid = lic.id),0) as totalpaid
FROM license lic
INNER JOIN company comp on lic.licensecompanyid= comp.id;
This sql runs fine in the Query Browser of mysql and returns what I want.
When I try to add this SQL command to a new Crystal Report, (by right clicking in the sql editor and selecting Crystal Reports - Add to new Crystal Report), it locks up my Eclipses and it ends up not responding. If I just do a simple SELECT * FROM license it works fine.
The Eclipse I'm using is from the CR4E download page with the crystal plugin already installed.
Any help with this would be greatful, as I am not having much joy with this CR4E 2.0 with MySQL and may have to scrap it and go back creating reports in Apache POI.
Any help greatly received.
Kind regardsHi,
Try to select a particular columns instead of doing SELECT * FROM license.
Thanks,
Saravanakumar -
How can I search multiple columns in a SQL command of Union tables
Hi:
We have a database with tables that are nearly identical that we use for production and production history.
I have created an SQL command in Crystal 2008 to joins several of the tables and then added a "UNION" to connect the History and Prod tables.
I need to search multiple (3 total) columns for 5 different data types, to return the records being investigated. I tried this using an "OR" statement in the where clause and have had inconsistant results.
The first two or statement function perfectly the third works as long as the value being passed is numeric and the last two fail consistantly with invalid column name errors. It appears that crystal is getting confused and passing the wrong data type especially if I do a new search using a different option for the "?SearchParam"
Can some one offer some insite on how I can search these fields to return the record data needed
-- {?SearchParam} is the search parameter passed by Crystal that is a number 1 thru 5
-- {?Search_Val} is a parameter that is passed by Crystal that is a string of what to search for 1 = Numeric CMP ord #("TBSLI21"."LI21_OR_NO"), 2 = Numeric CI ord # ( "TBSLI33"."LI33_CI_OR_NO"),
-- 3 =String Ext Sys ord string ("TBSLI33"."LI33_EXT_SYS_SL_OR_NO"), 4 = String CMP Grp string ("TBSLI21"."LI21_OP_GRP_NO"), 5 = composit string PP ord string ("TBSOP13"."OP13_CLR_DAY" & "TBSOP13"."OP13_PP_GRP_SEQ_NO" & "TBSOP13"."OP13_CELL_ID")
SELECT "TBSLI21"."LI21_OR_NO",
"TBSLI21"."LI21_SH_DT_SCDL",
"TBSLI21"."LI21_TS_EN_ORIG",
"TBSLI21"."LI21_TS_SHIP",
"TBSLI21"."LI21_SYS_ORD_CD",
"TBSLI21"."LI21_SHIP_ID",
"TBSLI21"."LI21_WRKST_ID",
"TBSLI21"."LI21_LI_NO",
"TBSLI33"."LI33_CI_OR_NO",
"TBSLI33"."LI33_EXT_SYS_SL_OR_NO",
"TBSLI21"."LI21_OP_GRP_NO",
"TBSLI21"."LI21_LI_STAT",
"TBSOP13"."OP13_OP_GRP_STAT",
"TBSLI31"."LI31_LI_EV_DTL_TX",
"TBSLI31"."LI31_DT_EN",
"TBSLI31"."LI31_TM_EN",
"TBSLI31"."LI31_LI_EV",
"TBSLI21"."LI21_OP_WSH_FLNM",
"TBSLI21"."LI21_PR_ITF_CD",
"TBSLI21"."MFG_PLANT_CD",
"MFG_PLANT_LI"."MFG_PLANT_CD" as PrefPlant,
"TBSOP13"."OP13_OP_GRP_DSP_CD",
"TBSLI21"."LI21_LI_DSP_CD",
"TBSOP13"."OP13_CLR_DAY",
"TBSOP13"."OP13_PP_GRP_SEQ_NO",
"TBSOP13"."OP13_CELL_ID",
"MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG",
"TBSLI21"."LI21_OP_GRP_PS_NO1",
"TBSLI21"."LI21_POMS_MERGE_NO",
"TBSLI31"."LI31_OP_ID",
"TBSLI21"."LI21_LI_POR_FG",
"TBSLI21"."LI21_BIN_ID",
"TBSLI21"."LI21_TS_MRSHL",
"TBSLI33"."LI33_CI_LI_NO",
"TBSLI33"."LI33_SH_ADDR_1",
"TBSLI33"."LI33_SH_ADDR_2",
"TBSLI33"."LI33_SH_ADDR_3",
"TBSLI33"."LI33_SH_ADDR_4",
"TBSLI33"."LI33_SH_CITY_NM",
"TBSLI33"."LI33_SH_ST_NM",
"TBSLI33"."LI33_SH_ZIP_CD",
"TBSLI33"."LI33_CU_NM",
"TBSLI33"."LI33_CU_BUS_NM"
FROM ((("CMPREPORTING"."dbo"."TBSLI33" "TBSLI33" FULL OUTER JOIN "CMPREPORTING"."dbo"."TBSLI21" "TBSLI21" ON ("TBSLI33"."LI33_BS_OR_NO"="TBSLI21"."LI21_OR_NO") AND ("TBSLI33"."LI33_BS_LI_NO"="TBSLI21"."LI21_LI_NO")) LEFT OUTER JOIN "CMPREPORTING"."dbo"."TBSOP13" "TBSOP13" ON "TBSLI21"."LI21_OP_GRP_NO"="TBSOP13"."OP13_OP_GRP_NO") LEFT OUTER JOIN "CMPREPORTING"."dbo"."TBSLI31" "TBSLI31" ON ("TBSLI21"."LI21_OR_NO"="TBSLI31"."LI31_OR_NO") AND ("TBSLI21"."LI21_LI_NO"="TBSLI31"."LI31_LI_NO")) LEFT OUTER JOIN "CMPREPORTING"."dbo"."MFG_PLANT_LI" "MFG_PLANT_LI" ON ("TBSLI21"."LI21_OR_NO"="MFG_PLANT_LI"."OR_NO") AND ("TBSLI21"."LI21_LI_NO"="MFG_PLANT_LI"."LI_NO")
WHERE {?aSearchParam} = 1 and "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG"='Y' AND "TBSLI21"."LI21_OR_NO"=Cast( {?Search_Val} as Int)
or {?aSearchParam} = 2 and "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG"='Y' AND "TBSLI33"."LI33_CI_OR_NO"=Cast( {?Search_Val} as numeric(12,0))
or {?aSearchParam} = 3 and "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG"='Y' AND Convert( VarChar(20),"TBSLI33"."LI33_EXT_SYS_SL_OR_NO")= Convert( VarChar(20), {?Search_Val})
or {?aSearchParam} = 4 and "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG"='Y' AND Convert( VarChar(8),"TBSLI21"."LI21_OP_GRP_NO") = Convert( VarChar(8), {?GroupNo})
or {?aSearchParam} = 5 and "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG"='Y' AND Convert( VarChar(8), ("TBSOP13"."OP13_CLR_DAY" & "TBSOP13"."OP13_PP_GRP_SEQ_NO" & "TBSOP13"."OP13_CELL_ID")) = Convert( VarChar(8), {?GroupNo})
Union
SELECT "TBSLI21_HIST"."LI21_OR_NO",
"TBSLI21_HIST"."LI21_SH_DT_SCDL",
"TBSLI21_HIST"."LI21_TS_EN_ORIG",
"TBSLI21_HIST"."LI21_TS_SHIP",
"TBSLI21_HIST"."LI21_SYS_ORD_CD",
"TBSLI21_HIST"."LI21_SHIP_ID",
"TBSLI21_HIST"."LI21_WRKST_ID",
"TBSLI21_HIST"."LI21_LI_NO",
"TBSLI33_HIST"."LI33_CI_OR_NO",
"TBSLI33_HIST"."LI33_EXT_SYS_SL_OR_NO",
"TBSLI21_HIST"."LI21_OP_GRP_NO",
"TBSLI21_HIST"."LI21_LI_STAT",
"TBSOP13_HIST"."OP13_OP_GRP_STAT",
"TBSLI31_HIST"."LI31_LI_EV_DTL_TX",
"TBSLI31_HIST"."LI31_DT_EN",
"TBSLI31_HIST"."LI31_TM_EN",
"TBSLI31_HIST"."LI31_LI_EV",
"TBSLI21_HIST"."LI21_OP_WSH_FLNM",
"TBSLI21_HIST"."LI21_PR_ITF_CD",
"TBSLI21_HIST"."MFG_PLANT_CD",
"MFG_PLANT_LI_HIST"."MFG_PLANT_CD",
"TBSOP13_HIST"."OP13_OP_GRP_DSP_CD",
"TBSLI21_HIST"."LI21_LI_DSP_CD",
"TBSOP13_HIST"."OP13_CLR_DAY",
"TBSOP13_HIST"."OP13_PP_GRP_SEQ_NO",
"TBSOP13_HIST"."OP13_CELL_ID",
"MFG_PLANT_LI_HIST"."PRFR_MFG_PLANT_FLG",
"TBSLI21_HIST"."LI21_OP_GRP_PS_NO1",
"TBSLI21_HIST"."LI21_POMS_MERGE_NO",
"TBSLI31_HIST"."LI31_OP_ID",
"TBSLI21_HIST"."LI21_LI_POR_FG",
"TBSLI21_HIST"."LI21_BIN_ID",
"TBSLI21_HIST"."LI21_TS_MRSHL",
"TBSLI33_HIST"."LI33_CI_LI_NO",
"TBSLI33_HIST"."LI33_SH_ADDR_1",
"TBSLI33_HIST"."LI33_SH_ADDR_2",
"TBSLI33_HIST"."LI33_SH_ADDR_3",
"TBSLI33_HIST"."LI33_SH_ADDR_4",
"TBSLI33_HIST"."LI33_SH_CITY_NM",
"TBSLI33_HIST"."LI33_SH_ST_NM",
"TBSLI33_HIST"."LI33_SH_ZIP_CD",
"TBSLI33_HIST"."LI33_CU_NM",
"TBSLI33_HIST"."LI33_CU_BUS_NM"
FROM ((("CMPREPORTING"."dbo"."TBSLI33_HIST" "TBSLI33_HIST" FULL OUTER JOIN "CMPREPORTING"."dbo"."TBSLI21_HIST" "TBSLI21_HIST" ON ("TBSLI33_HIST"."LI33_BS_OR_NO"="TBSLI21_HIST"."LI21_OR_NO") AND ("TBSLI33_HIST"."LI33_BS_LI_NO"="TBSLI21_HIST"."LI21_LI_NO")) LEFT OUTER JOIN "CMPREPORTING"."dbo"."TBSOP13_HIST" "TBSOP13_HIST" ON "TBSLI21_HIST"."LI21_OP_GRP_NO"="TBSOP13_HIST"."OP13_OP_GRP_NO") LEFT OUTER JOIN "CMPREPORTING"."dbo"."TBSLI31_HIST" "TBSLI31_HIST" ON ("TBSLI21_HIST"."LI21_OR_NO"="TBSLI31_HIST"."LI31_OR_NO") AND ("TBSLI21_HIST"."LI21_LI_NO"="TBSLI31_HIST"."LI31_LI_NO")) LEFT OUTER JOIN "CMPREPORTING"."dbo"."MFG_PLANT_LI_HIST" "MFG_PLANT_LI_HIST" ON ("TBSLI21_HIST"."LI21_OR_NO"="MFG_PLANT_LI_HIST"."OR_NO") AND ("TBSLI21_HIST"."LI21_LI_NO"="MFG_PLANT_LI_HIST"."LI_NO")
WHERE {?aSearchParam} = 1 and "MFG_PLANT_LI_HIST"."PRFR_MFG_PLANT_FLG"='Y' AND "TBSLI21_HIST"."LI21_OR_NO"= Cast( {?Search_Val} as Int)
or {?aSearchParam} = 2 and "MFG_PLANT_LI_HIST"."PRFR_MFG_PLANT_FLG"='Y' AND "TBSLI33_HIST"."LI33_CI_OR_NO"= Cast( {?Search_Val} as numeric(12,0))
or {?aSearchParam} = 3 and "MFG_PLANT_LI_HIST"."PRFR_MFG_PLANT_FLG"='Y' AND Convert( VarChar(20), "TBSLI33_HIST"."LI33_EXT_SYS_SL_OR_NO")= Convert( VarChar(20),{?Search_Val})
or {?aSearchParam} = 4 and "MFG_PLANT_LI_HIST"."PRFR_MFG_PLANT_FLG"='Y' AND Convert( VarChar(8),"TBSLI21_HIST"."LI21_OP_GRP_NO")= Convert( VarChar(8), {?GroupNo} )
or {?aSearchParam} = 5 and "MFG_PLANT_LI_HIST"."PRFR_MFG_PLANT_FLG"='Y' AND Convert( VarChar(8), ("TBSOP13_HIST"."OP13_CLR_DAY" & "TBSOP13_HIST"."OP13_PP_GRP_SEQ_NO" & "TBSOP13_HIST"."OP13_CELL_ID")) = Convert( VarChar(8), {?GroupNo})This is actually a fairly easy fix - because of the way the "OR" works in SQL, you need to surround each "set" of statements in the or with parentheses. So, it would look something like this:
Where
({?aSearchParam} = 1 and "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG"='Y' AND "TBSLI21"."LI21_OR_NO"=Cast( {?Search_Val} as Int))
or
({?aSearchParam} = 2 and "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG"='Y' AND "TBSLI33"."LI33_CI_OR_NO"=Cast( {?Search_Val} as numeric(12,0)))
or
({?aSearchParam} = 3 and "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG"='Y' AND Convert( VarChar(20),"TBSLI33"."LI33_EXT_SYS_SL_OR_NO")= Convert( VarChar(20), {?Search_Val}))
or
({?aSearchParam} = 4 and "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG"='Y' AND Convert( VarChar(8),"TBSLI21"."LI21_OP_GRP_NO") = Convert( VarChar(8), {?GroupNo}))
or
({?aSearchParam} = 5 and "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG"='Y' AND Convert( VarChar(8), ("TBSOP13"."OP13_CLR_DAY" & "TBSOP13"."OP13_PP_GRP_SEQ_NO" & "TBSOP13"."OP13_CELL_ID")) = Convert( VarChar(8), {?GroupNo}))
-Dell -
How to execute stored procedure in the SQL Commands page
i'm oracle express edition newbie :) i have this stored procedure. it not belong to a package.
create or replace procedure "LIST_MEMBERS"
("MEMBER_CUR" OUT SYS_REFCURSOR)
is
begin
OPEN MEMBER_CUR FOR
SELECT * FROM members;
end;
now, in the SQL Commands page, how to run the stored procedure and return the records. i do this:
begin
execute list_members();
end;
but i'm getting some errors. just need some immediate help :) thanks!!!Example of using a ref cursor:
SQL> ed
Wrote file afiedt.buf
1 create or replace procedure open_cur(c IN OUT SYS_REFCURSOR) is
2 begin
3 open c for 'select rownum rn from dual connect by rownum <= 10';
4* end;
SQL> /
Procedure created.
SQL> ed
Wrote file afiedt.buf
1 declare
2 c SYS_REFCURSOR;
3 v_val NUMBER;
4 begin
5 open_cur(c);
6 loop
7 fetch c INTO v_val;
8 exit WHEN c%NOTFOUND;
9 dbms_output.put_line(v_val);
10 end loop;
11 close c;
12* end;
SQL> /
1
2
3
4
5
6
7
8
9
10
PL/SQL procedure successfully completed.
SQL> -
SQL Command returns multiple records, but I see only one record in report
I work with Crystal Reports XI R2 SP3 and Oracle 10g R2 database.
I have an SQL Command that returns multiple records. Command name is "CommDivisionNames" and it returns column "CommDivisionNames.DIVISION_NAME". When I place this field into report details section of the report, I can see all 10 records returned and this is how it should be. I actually need this field to be placed in the report header section, and when I place the field there, then I see only the first record. I set that field as "can grow = true". When I do "browse field data" for this field, I see that all 10 records are there, but only the first one is displayed in report header section.
I thought that I can place SQL Command field anywhere on the report (page header, footer, details) and that it will always show all records that it returns from the database. Can that be done?
My "main part" of the report returns different set of records, and that's what I have in "report details" section. I need this list of divisions to be in the report header section, so user can see that the report was executed for DivA, DivC, DivE.
Thank you,
Milansharonamt:
Users select divisions from parameter, but the parameter multi values are division_numbers (1,5,10), not division_names. Division_names are visible in parameter_prompt_window as description, but parameter remembers only numbers and I don't know how I can reuse division_names later in formula.
I do join for division_numbers and make them into one string variable and pass to sub-report, but I think that I can only get these division_names by calling an SQL command or calling stored procedure.
If I try to do join({MySQLcommand.DIVISION_NAME}) I get error message "A string array is required here".
Carl:
I'm playing with cross-tab and I can use it to see all division_names in the report-header section. Since I need them in only one column or only one row, I have to edit cross-tab object and turn all unneeded border lines to white to make them look invisible. So, cross-tab could be a solution for my problem here.
Another option could be to re-write my SQL command. Since I've read here that SQL command could be written in the same way as I would write a stored procedure, then I could use a bit more complex code to get all multiple division names from the database table into a local cursor, and then use do-while loop to concatenate them into one string, and then to return that string as one record (like 'DivA, DivB, DivC'), and then it should not be a problem to display only that one record/string in report header. It is my understanding that Crystal Reports can call stored procedure that works with many cursors/recordsets and CR will use only the last recordset from the stored procedure. Do you think it could be done this way?
Thank you,
Milan -
ORA-00933: SQL command not properly ended
I am attempting to create a view in oracle 8.0.6 but get the error message ORA-00933 SQL command not properly ended, can anyone help?:
SQL> create view AJT_SCHEDULES01 as
2 select SCHDL_REFNO, STRAN_REFNO from SCHEDULES order by STRAN_REFNO desc;
select SCHDL_REFNO, STRAN_REFNO from SCHEDULES order by STRAN_REFNO desc
ERROR at line 2:
ORA-00933: SQL command not properly endedORDER BY cannot be used to create an ordered view or to insert in a certain order.
Please refer to Section ORA-00933: SQL command not properly ended at : http://otn.oracle.com/doc/server.805/a58312/newch220.htm
For further assistance, please post in the forum at : PL/SQL
Hope this helps
Regards
Pushkala
Maybe you are looking for
-
CSS Designer in Depth | Creative Cloud for Web | Adobe TV
Get an in-depth look at the powerful new CSS Designer tools in Dreamweaver CC. Intuitive visual editing tools help you generate clean, web-standard code and quickly apply CSS properties like gradients and box shadows. You can see the effects on your
-
Merge Different Spools containing a Single PDF page into a Single PDF file.
Greetings, I am developing a custom object where in i need to read PDF file from many different Spools(Range given on Input Screen), where each spool has a single PDF page in it. I need to combine all these PDF Pages into a single PDF file & either c
-
what is the best way to connect my imac to internet via airport express. wireless or ethernet plug to airport? thanks
-
How many special charcters in RSKC
Hi Guru,s. Could any one tell me, how many special characters we can enter in RSKC, which have been asked in the interview. Regards. Harry
-
Urgent !!!!! Updating Inbound deliveries via Idoc type DELVRY05
Hi, Is there a way to update an existing inbound delivery through the Idoc type DELVRY05. I'm able to create an Inbound delivery using this Idoc type. But im not able to update the same. There is a field VBELN, in segment E1EDL20. But whenever i pa