Query for Find Mode Fails-AutoGenerated WHERE clause missing quotation mark
Using Oracle JDev 10.1.3.2. In 'Find Mode' the query execution fails.
The error shown below is caused by the WHERE clause statement. The column name is quoted in the database but the code generated by the ADF framework does not use quotes. As a result the column name is illegal. Is there a way to hint to the ADF framework to ALWAYS use quotation marks?
(oracle.jbo.SQLStmtException) JBO-27122: SQL error during statement preparation. Statement: SELECT * FROM (SELECT "PLATE","WROW","WCOL","WFIELD","AVGNUC.NUC_CELL_INTENSITY","MEDNUC.NUC_CELL_INTENSITY","AVGORG.INCLUSION_BCKG_INTE","MEDORG.INCLUSION_BCKG_INTE","MEDORG.COUNT","MEDORG.SPACING","MEDORG.NEIGHBOR_COUNT" FROM ICSUMSTAS_1888_295) QRSLT WHERE ( ( (MEDORG.COUNT >0) ) )
It is true that these are not the most column 'friendly' names, but they are what they are. In the database these columns are quoted and they must be so in order for the query to work correctly.
The suggestion of directly manipulating the View Criteria is a good one and I have implemented a solution based on it but it's cumbersome. Here is how it works:
First, use the default query mode UI to add new View Criteria. If you were to execute the query at this point it would fail due to the columns names not being quoted. So, instead, implemented my own execute query button that first uses the View Criteria to create a properly quoted WhereClause for the ViewObject.
I then reset the ViewCriteria (or they will interfere with the WhereClause), set the custom constructed WhereClause on the ViewObject, and re-execute the query. The cumbersome part is that I have to create my own parser for user input to write a valid WhereClause. And when the user uses query mode again the previously set ViewCriteria have been reset (which is annoying, and not the typical query mode behavior which might confuse the user)
below are some of my code snippets:
* This action is triggered by clicking the FIND button on the UI.
* It uses a combination of the ViewCriteria default UI and custom code that processes
* user input into a whereClause for the ViewObject
private void jbFind_actionPerformed(ActionEvent e) {
jbAddRow.setEnabled(false);
//reset old where clause
System.out.println("OLD WHERE:"+myView.getWhereClause());
myView.setWhereClause(null);
String customWhere=getCustomWhere();
/* The case for null and blank View Criteria is tested below
* when there are blank ViewCriteria the sequence (--) is generated from getCustomWhere
* Note the use of contains instead of equals
* The use of equalIgnoreCase etc for unexplained reasons seem to fail to detect when customWhere is (--)
if(customWhere==null||customWhere.contains("(--)")){
return;
}else{
/*remove ViewCriteria because they can not handle special Column names
* That's why we go into the trouble of creating our own find function
myView.getViewCriteria().removeAllElements();
myView.setWhereClause(customWhere);
myView.executeQuery();
jUNavigationBar1.doAction(JUNavigationBar.BUTTON_EXECUTE);
jTable1.revalidate();
private String getCustomWhere(){
StringBuffer custom=new StringBuffer();
ApplicationModule am = (ApplicationModule) panelBinding.getApplication().getDataProvider();
DCJboDataControl jbodc = new DCJboDataControl(am);
JUIteratorBinding iterBinding = new JUIteratorBinding(jbodc,myView );
int criteriaCount=iterBinding.getViewCriteria().getRowCount();
//Validation when no ViewCriteria are defined
if (criteriaCount==0){
System.out.println("ViewCriteria Count: "+criteriaCount);
return null;
}else{
System.out.println("ViewCriteria Count: "+criteriaCount);
int attr=iterBinding.getViewCriteria().getCurrentRow().getAttributeCount();
int criteriaRows=iterBinding.getViewCriteria().getAllRowsInRange().length;
String[] attrNames=iterBinding.getViewCriteria().getCurrentRow().getAttributeNames();
for (int r=0;r<criteriaRows;r++)
{custom.append("(");
for (int k=0;k<attr;k++){
if(iterBinding.getViewCriteria().getRowAtRangeIndex(r).getAttribute(k)!=null){
custom.append("(\""+attrNames[k]+"\"");// LIKE '"+(String)iterBinding.getViewCriteria().getRowAtRangeIndex(r).getAttribute(k)+"') AND ");
//trim white space
String attrK=((String)iterBinding.getViewCriteria().getRowAtRangeIndex(r).getAttribute(k)).trim();
String qual=attrK.substring(0,1);
if(qual.equalsIgnoreCase(">")||qual.equalsIgnoreCase("<")||qual.equalsIgnoreCase("=")||qual.equalsIgnoreCase("!")){
custom.append(" "+qual+"'"+attrK.substring(1)+"') AND " );
}else{
custom.append(" LIKE '"+(String)iterBinding.getViewCriteria().getRowAtRangeIndex(r).getAttribute(k)+"') AND ");
}custom.append("--");
custom.append(")");
custom.append(" OR ");
}//end criteria rows
custom.append("--");
//now need to remove terminal AND and OR tagged with --
String cleanWhere=custom.toString().replaceAll("AND --","").replaceAll("OR --","");
System.out.println("NEW CUSTOM WHERE: "+cleanWhere);
return cleanWhere;
}
Similar Messages
-
In perfdatasource querying for global snapshot failed with error 'the size limit for this '
I received scom alerts from two win 2k8 r2 servers , hosting exchange 2010 mailbox roles , the alerts came almost in same time from both servers ,
can I ignore those alerts
or can someone give a me a clue how can I troubleshoot those alert , please any help would be appreciated
In PerfDataSource, querying for Global Snapshot failed with error 'The size limit for this '
from Ops-mgmt logs
Log Name: Operations Manager
Source: Health Service Modules
Date:
Event ID: 10104
Task Category: None
Level: Error
Keywords: Classic
User: N/A
Computer: server 1
Description:
In PerfDataSource, querying for Global Snapshot failed with error 'The size limit for this '
One or more workflows were affected by this.
Workflow name: Microsoft.Windows.Server.2008.OperatingSystem.PercentMemoryUsed.Collection
Instance name: Microsoft Windows Server 2008 R2 Enterprise
Log Name: Operations Manager
Source: Health Service Modules
Date:
Event ID: 10104
Task Category: None
Level: Error
Keywords: Classic
User: N/A
Computer: server 1
Description:
In PerfDataSource, querying for Global Snapshot failed with error 'The size limit for this '
One or more workflows were affected by this.
Workflow name: Microsoft.Windows.Server.2008.LogicalDisk.PercentIdle.Collection
Instance name: " edb file path "
Log Name: Operations Manager
Source: Health Service Modules
Date:
Event ID: 10104
Task Category: None
Level: Error
Keywords: Classic
User: N/A
Computer: server 2
Description:
In PerfDataSource, querying for Global Snapshot failed with error 'The size limit for this '
One or more workflows were affected by this.
Workflow name: Microsoft.Windows.Server.2008.NetworkAdapter.CurrentBandwidth.Collection
Log Name: Operations Manager
Source: Health Service Modules
Date:
Event ID: 10104
Task Category: None
Level: Error
Keywords: Classic
User: N/A
Computer: server 2
Description:
In PerfDataSource, querying for Global Snapshot failed with error 'The size limit for this '
One or more workflows were affected by this.
Workflow name: Microsoft.ForefrontProtection.FPE.Server.PerformanceCollection.RealtimeScanMessageRateHi Blake ,
Thanks for your reply , I appreciate your help ,
I didn't put the alert from scom console because they were same as the events ( same source )
Health Service Modules, I didn't want to spam
more :-)
also the two servers encountered the issue were mailbox servers and part of same DAG , it worth mention the alert were resolved
by Exchange 2010 Correlation Engine service
http://blogs.technet.com/b/kevinholman/archive/2010/10/15/clustering-the-exchange-2010-correlation-engine-service.aspx
http://support.microsoft.com/kb/2592561
also the Opsmgmt logs are full of waring and error event like 2023 , 21402 , 21403 , 1207 !!
Log Name: Operations Manager
Source: HealthService
Date:
Event ID: 2023
Task Category: Health Service
Level: Warning
Keywords: Classic
User: N/A
Computer: server 1
Description:
The health service has removed some items from the send queue for management group "SCOM" since it exceeded the maximum allowed size of 15 megabytes.
1- alert from console >>
In PerfDataSource, querying for Global Snapshot failed with error 'The size limit for this '
One or more workflows were affected by this.
Workflow name: Microsoft.Windows.Server.2008.OperatingSystem.PercentMemoryUsed.Collection
Instance name: Microsoft Windows Server 2008 R2 Enterprise
EventSourceName: Health Service Modules -
Hi,
Currently I'm trying to run Oracle database backup using EM database control and OSB. I have configure library and tape drive in OSB and also created new job in EM to backup the database. But when I run the job it end up with the following error message.
If anyone encounter the same problem? and you know the solution. Please let me know in detail.
RMAN-00571:
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS
RMAN-00571:
RMAN-03009: failure of backup command on oem_sbt_backup channel at 03/12/2008 19:11:12
ORA-19506: failed to create sequential file, name="1ujb3oqb_1_1", parms=""
ORA-27028: skgfqcre: sbtbackup returned error
ORA-19511: Error received from media manager layer, error text:
sbt__rpc_cat_query: Query for piece 1ujb3oqb_1_1 failed.
I really need help from you guy's.
Thanks,
BalaThanks. But I don't think that is the issue. I've compared the values on this server with the values on my other servers that are running OSB client successfully and they are comparible.
Rich
oracle@vlx1032 /ora01/oracle > grep ^[^#] /etc/sysctl.conf
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
kernel.shmmax = 8589934592
kernel.shmall = 16777216
kernel.msgmnb = 65536
kernel.msgmni = 256
kernel.sem = 300 32000 100 1024
fs.file-max = 131072
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 1048576
net.core.wmem_default = 1048576
net.core.rmem_max = 1048576
net.core.wmem_max = 1048576 -
Write a query for finding STDDEV for OLAP Cube
Can anybody post a sample query which will find the standard deviation of sales for each month in the sample GLOBAL OLAP schema for Oracle 11g.
The OLAP option automatically generates a set of relational views on cubes, dimensions, and hierarchies in Oracle 11g. So how can i write a query for finding the Standard deviation on these views.The easiest way to do this is to do this directly within the AW using a custom calculated measure. In AWM11g you can use the 11g custom measure wrapper to execute the STDDEV function:
olap_dml_expression('function',data type)
For example
olap_dml_expression('STDDEV(cube_name, time_dimension_name)',number)
You can then simply expose this calculated measure as another column in your SQL View and then there is no need to use the SQL equivalent. This means the calculation is performed inside the AW (which is as close to the source data as you can get) ensuring performance of the whole query remains high.
If necessary you can take this a step further, if required, and wrap the STDDEV calculation within an OLAP DML program that would allow you to manipulate the status of time within the calculation. For example, you may want the STDDEV calc to only take into account the last 12 time periods rather than all time periods currently in status.
Hope this helps
Keith Laker
Oracle EMEA Consulting
OLAP Blog: http://oracleOLAP.blogspot.com/
OLAP Wiki: http://wiki.oracle.com/page/Oracle+OLAP+Option
DM Blog: http://oracledmt.blogspot.com/
OWB Blog : http://blogs.oracle.com/warehousebuilder/
OWB Wiki : http://wiki.oracle.com/page/Oracle+Warehouse+Builder
DW on OTN : http://www.oracle.com/technology/products/bi/db/11g/index.html -
Expert mode query in View objects and appended where clause
My company is Oracle Member Partner and we are developing enterprise web applications using Oracle database and BC4J.
I have the following problem...
When I enable EXPERT MODE option in View Object I have trouble appending to query statement in my client code.
I need expert mode because I must use "SELECT DISTINCT" insted of "SELECT" in my query.
It looks something like this:
viewObject.setWhereClause("CLA_ID = " + claId);
viewObject.executeQuery();
SQL query from View Object becomes sub-query and fails to execute:
select * from (original view object query) where (... appended where clause)
Order by part of the query causes sql errors because original query is now sub-query.
Is there any way around this?I tried creating an expert mode SQL query:
SELECT DISTINCT EMPNO, ENAME FROM EMP.
Then at runtime I do:
vo.setWhereClause("ENAME LIKE '%'||?||'%');
vo.setWhereClauseParam(0,'A');.
and this works fine. The trick is that since expert-mode view objects get wrapped as inline views (to allow runtime appending of WHERE clause, actually), you need to select any column in the select statement to which you want to later refer in a dynamically-appended where clause.
If you want to prevent the inline-view wrapping, you can write the following code in your view object's ViewObjectImpl subclass to force the VO to NOT be treated as an expert-mode SQL VO.
// Goes in your view object impl subclass
public void create() {
// Force this VO to NOT be treated as an expert-mode SQL, so that
// its query does not get wrapped as an inline view.
getViewDef().setFullSql(false);
}I used this trick above to create an expert mode query like:
SELECT DISTINCT deptno FROM empand then at runtime I add a dynamic where clause that refers to a column
in EMP that is not in the select list like this:
ViewObject vo = am.findViewObject("View1");
vo.setWhereClause("ename like '%A%'");
vo.executeQuery();
System.out.println(vo.first().getAttribute(0));and this causes the query to come out as:
SELECT DISTINCT deptno FROM emp WHERE ename like '%A%'.
instead of:
SELECT * FROM (SELECT DISTINCT deptno FROM emp) QRSLT WHERE ename like '%A%'which would cause an error due to the fact that ename is not in the select list of the original (wrapped, inline) query. -
Query For Finding Yearly Opening and Closing Balance for All the Items
Hi Experts,
I am working on Query Based Report for finding the Yearly Opening and Closing Stock for all the Items
i will give yearwise selection and I want opening and closing stock in between that years
Warm Regards,
Sandip Kokate
Edited by: Sandipk on May 20, 2011 1:58 PMHi,
Declare @SDate DateTime
Declare @EDate DateTime
Declare @Whse nvarchar(10)
Set @SDate= (SELECT min(F_RefDate) FROM OFPR T1 where T1.[Name] ='[1%]' )
Set @EDate= (SELECT max(T_RefDate) FROM OFPR T1 where T1.[Name] ='[%1]' )
Set @Whse=(Select Max(s2.Warehouse) from OINM S2 Where S2.Warehouse = '[%2]')
BEGIN
Select @Whse as 'Warehouse', a.Itemcode, max(a.Dscription) as ItemName,
sum(a.OpeningBalance) as OpeningBalance, sum(a.INq) as 'IN', sum(a.OUT) as OUT,
((sum(a.OpeningBalance) + sum(a.INq)) - Sum(a.OUT)) as Closing ,
(Select i.InvntryUom from OITM i where i.ItemCode=a.Itemcode) as UOM
from( Select N1.Warehouse, N1.Itemcode, N1.Dscription, (sum(N1.inqty)-sum(n1.outqty))
as OpeningBalance, 0 as INq, 0 as OUT From dbo.OINM N1
Where N1.DocDate < @SDate and N1.Warehouse = @Whse Group By N1.Warehouse,N1.ItemCode,
N1.Dscription Union All select N1.Warehouse, N1.Itemcode, N1.Dscription, 0 as OpeningBalance,
sum(N1.inqty) , 0 as OUT From dbo.OINM N1 Where N1.DocDate >= @SDate and N1.DocDate <= @EDate
and N1.Inqty >0 and N1.Warehouse = @Whse Group By N1.Warehouse,N1.ItemCode,N1.Dscription
Union All select N1.Warehouse, N1.Itemcode, N1.Dscription, 0 as OpeningBalance, 0 , sum(N1.outqty) as OUT
From dbo.OINM N1 Where N1.DocDate >= @SDate and N1.DocDate <=@EDate and N1.OutQty > 0
and N1.Warehouse = @Whse Group By N1.Warehouse,N1.ItemCode,N1.Dscription) a, dbo.OITM I1
where a.ItemCode=I1.ItemCode
Group By a.Itemcode Having sum(a.OpeningBalance) + sum(a.INq) + sum(a.OUT) > 0 Order By a.Itemcode
END
I hope this will work for you.
In above query you can also user OFPR.Code, OFPR, Category OFPR.Indicator instead of OFPR.Name.
Regards
Vaibhav Anharwadkar
Edited by: Vaibhav Ancharwadkar on May 24, 2011 9:23 AM -
Query slow down when added a where clause
I have a procedure that has performance issue, so I copy some of the query and run in the sql plus and try to spot which join cause the problem, but I get a result which I can figuer out why. I have a query which like below:
Select Count(a.ID) From TableA a
-- INNER JOIN other tables
WHERE a.TypeID = 2;
TableA has 140000 records, when the where clause is not added, the count return quite quick, but if I add the where clause, then the query slow down and seems never return so I have to kill my SQL Plus session. TableA has index on TypeID and TypeID is a number type. When TablA has 3000 records, the procedure return very quick, but it slow down and hang there when the TableA contains 140000 records. Any idea why this will slow down the query?
Also, the TypeID is a foreign key to another table (TableAType), so the query above can written as :
Select Count(a.ID) From TableA a
-- INNER JOIN other tables
INNER JOIN TableAType atype ON a.TypeID = atype.ID
WHERE atype.Name = 'typename';
TableAType table is a small table only contains less than 100 records, in this case, would the second query be more efficient to the first query?
Any suggestions are welcome, thanks in advance...
Message was edited by:
user500168TableA now has 230000 records and 28000 of them has the TypeID 2.
I haven't use the hint yet but thank you for your reply which let me to to run a query to check how many records in TableA has TypeID 2. When I doing this, it seems pretty fast. So I begin with the select count for TableA only and gradually add table to join and seems the query is pretty fast as long as TableA is the fist table to select from.
Before in my query TableA is the second table to join from, there is another table (which is large as well but not as large as TableA) before TableA. So I think this is why it runs slow before. I am not at work yesterday so the query given in my post is based on my roughly memory and I forget to mention another table is joined before TableA, really sorry about that.
I think I learn a lesson here, the largest table need to be in the begining of the select statement...
Thank you very much everyone. -
UPDATE Statement executing for whole table even when WHERE Clause is presen
Hi Friends,
I have a problem in a stored procedure where i have written an update statement with a where clause. At a time only one row should get updated depending upon unique identifier in where clause.
But whats happening is that Update statement is getting executed for all the rows in the table neglecting the WHERE clause. I am not getting the clue as to why this is happening. Here is the stored Procedure And the update statement is in BOLD :-
CREATE OR REPLACE PROCEDURE MDMADM.proc_MDM_InsertCntryDetails
CntryMasterCode IN VARCHAR2,
CntryName IN VARCHAR2,
MDMUser IN VARCHAR2,
Exist IN INTEGER,
status IN VARCHAR2,
Inserted_By IN VARCHAR2 DEFAULT NULL,
Modified_By IN VARCHAR2 DEFAULT NULL,
Mdm_Code IN NUMBER DEFAULT 0,
Action IN VARCHAR2 DEFAULT 'add',
XGenAttNames IN VARCHAR2 DEFAULT NULL,
XGenAttValues IN VARCHAR2 DEFAULT NULL,
MirusAttNames IN VARCHAR2 DEFAULT NULL,
MirusAttValues IN VARCHAR2 DEFAULT NULL,
GenisysAttNames IN VARCHAR2 DEFAULT NULL,
GenisysAttValues IN VARCHAR2 DEFAULT NULL,
XGenModify IN VARCHAR2 DEFAULT NULL,
MirusModify IN VARCHAR2 DEFAULT NULL,
GenisysModify IN VARCHAR2 DEFAULT NULL
IS
strSQLXGen VARCHAR(1000);
strSQLMirus VARCHAR(1000);
strSQLGenisys VARCHAR(1000);
nMaxMDMCode INTEGER;
ifExist INTEGER;
NAME: proc_MDM_InsertCntryDetails
PURPOSE:
REVISIONS:
Ver Date Author Description
1.0 7/3/2009 1. Created this procedure.
NOTES:
Automatically available Auto Replace Keywords:
Object Name: proc_MDM_InsertCntryDetails
Sysdate: 7/3/2009
Date and Time: 7/3/2009, 7:11:20 PM, and 7/3/2009 7:11:20 PM
Username: (set in TOAD Options, Procedure Editor)
Table Name: (set in the "New PL/SQL Object" dialog)
BEGIN
SELECT COUNT(*) INTO ifExist FROM MDM_COUNTRY_MASTER;
IF ifExist = 0 THEN
SELECT 1 INTO nMaxMDMCode FROM DUAL;
ELSE
SELECT MAX(MDM_CODE)+1 INTO nMaxMDMCode FROM MDM_COUNTRY_MASTER;
END IF;
IF Action='add' THEN
INSERT INTO MDM_COUNTRY_MASTER(MDM_CODE,MDM_MASTER_CODE,MDM_DESCRIPTION,MDM_USER,MDM_EXIST,MDM_STATUS,MDM_ACTION,DAT_INSERT_DATE,DAT_INSERTED_BY)
VALUES(nMaxMDMCode,CntryMasterCode,CntryName,MDMUser,Exist,status,Action,SYSDATE,Inserted_By);
strSQLXGen := 'INSERT INTO MDM_COUNTRY_MAPPING(MDM_CODE,SYSTEM_NAME,SYSTEM_CODE,' || XGenAttNames || ',DAT_INSERTED_BY,DAT_INSERT_DATE) ' ||
'VALUES(' || nMaxMDMCode || ',' || '''' || 'XGen' || '''' || ',1,' || XGenAttValues || ',' || '''' || Inserted_By || '''' || ',SYSDATE)';
EXECUTE IMMEDIATE strSQLXGen;
strSQLMirus := 'INSERT INTO MDM_COUNTRY_MAPPING(MDM_CODE,SYSTEM_NAME,SYSTEM_CODE,' || MirusAttNames || ',DAT_INSERTED_BY,DAT_INSERT_DATE) ' ||
'VALUES(' || nMaxMDMCode || ',' || '''' || 'Mirus' || '''' || ',2,' || MirusAttValues || ',' || '''' || Inserted_By || '''' || ',SYSDATE)';
EXECUTE IMMEDIATE strSQLMirus;
strSQLGenisys := 'INSERT INTO MDM_COUNTRY_MAPPING(MDM_CODE,SYSTEM_NAME,SYSTEM_CODE,' || GenisysAttNames || ',DAT_INSERTED_BY,DAT_INSERT_DATE) ' ||
'VALUES(' || nMaxMDMCode || ',' || '''' || 'Genisys' || '''' || ',3,' || GenisysAttValues || ',' || '''' || Inserted_By || '''' || ',SYSDATE)';
EXECUTE IMMEDIATE strSQLGenisys;
ELSE
UPDATE MDM_COUNTRY_MASTER
SET MDM_DESCRIPTION=CntryName,DAT_MODIFIED_BY=Modified_By,DAT_MODIFY_DATE=SYSDATE,
MDM_USER=MDMUser,MDM_ACTION=Action,MDM_STATUS=status,MDM_EXIST=Exist WHERE MDM_CODE=Mdm_Code;
SELECT COUNT(*) INTO ifExist FROM MDM_COUNTRY_MAPPING WHERE SYSTEM_CODE=1 AND MDM_CODE=Mdm_Code ;
IF ifExist = 0 THEN
strSQLXGen := 'INSERT INTO MDM_COUNTRY_MAPPING(MDM_CODE,SYSTEM_NAME,SYSTEM_CODE,' || XGenAttNames || ',DAT_INSERTED_BY,DAT_INSERT_DATE) ' ||
'VALUES(' || Mdm_Code || ',' || '''' || 'XGen' || '''' || ',1,' || XGenAttValues || ',' || '''' || Modified_By || '''' || ',SYSDATE)';
EXECUTE IMMEDIATE strSQLXGen ;
ELSE
strSQLXGen := 'UPDATE MDM_COUNTRY_MAPPING SET ' || XGenModify || ',DAT_MODIFY_DATE=SYSDATE,DAT_MODIFIED_BY=' || '''' || Modified_By || '''' || ' WHERE MDM_CODE=' || Mdm_Code || ' and SYSTEM_CODE=1' ;
EXECUTE IMMEDIATE strSQLXGen ;
END IF;
SELECT COUNT(*) INTO ifExist FROM MDM_COUNTRY_MAPPING WHERE SYSTEM_CODE=2 AND MDM_CODE=Mdm_Code ;
IF ifExist = 0 THEN
strSQLMirus := 'INSERT INTO MDM_COUNTRY_MAPPING(MDM_CODE,SYSTEM_NAME,SYSTEM_CODE,' || MirusAttNames || ',DAT_INSERTED_BY,DAT_INSERT_DATE) ' ||
'VALUES(' || Mdm_Code || ',' || '''' || 'Mirus' || '''' || ',2,' || MirusAttValues || ',' || '''' || Modified_By || '''' || ',SYSDATE)';
EXECUTE IMMEDIATE strSQLMirus ;
ELSE
strSQLMirus := 'UPDATE MDM_COUNTRY_MAPPING SET ' || MirusModify || ',DAT_MODIFY_DATE=SYSDATE,DAT_MODIFIED_BY=' || '''' || Modified_By || '''' || ' WHERE MDM_CODE=' || Mdm_Code || ' and SYSTEM_CODE=2' ;
EXECUTE IMMEDIATE strSQLMirus ;
END IF;
SELECT COUNT(*) INTO ifExist FROM MDM_COUNTRY_MAPPING WHERE SYSTEM_CODE=3 AND MDM_CODE=Mdm_Code;
IF ifExist = 0 THEN
strSQLGenisys := 'INSERT INTO MDM_COUNTRY_MAPPING(MDM_CODE,SYSTEM_NAME,SYSTEM_CODE,' || GenisysAttNames || ',DAT_INSERTED_BY,DAT_INSERT_DATE) ' ||
'VALUES(' || Mdm_Code || ',' || '''' || 'Genisys' || '''' || ',3,' || GenisysAttValues || ',' || '''' || Modified_By || '''' || ',SYSDATE)';
EXECUTE IMMEDIATE strSQLGenisys ;
ELSE
strSQLGenisys := 'UPDATE MDM_COUNTRY_MAPPING SET ' || GenisysModify || ',DAT_MODIFY_DATE=SYSDATE,DAT_MODIFIED_BY=' || '''' || Modified_By || '''' || ' WHERE MDM_CODE=' || Mdm_Code || ' and SYSTEM_CODE=3' ;
EXECUTE IMMEDIATE strSQLGenisys ;
END IF;
END IF;
EXCEPTION
WHEN NO_DATA_FOUND THEN
NULL;
WHEN OTHERS THEN
-- Consider logging the error and then re-raise
RAISE;
END proc_MDM_InsertCntryDetails;
ThanksIt might be helpful to search this forum and google for PL/SQL (variables, stored procs, etc) naming standards. There are quite a few out there and you can choose one that works for you.
As an example, a lot of standards adopt naming prefixes, ie v_ for VARCHAR variable, n_ for NUMBER variable, pv_ for paramater VARCHAR, etc. -
Recursive query for finding parents and children against two tables
Hi I have two tables where the data is stored hierarchially.
I have found using connect_by, level and other oracle functions doing its job when the data is in one table.
Can I traverse against two tables by using the same oracle functions.
My Table A can go 2 levels deep in my hierarchy and level 3 and so forth has to be done against a different table.
Appreciate your insight..
Thanks in advanceThe number of levels that I can traverse in the first table is dynamic (sometimes 2 levels and sometimes 3 levels and actually no level limit) and then has to dynamically start looking at second table for finding any more levels in the other table.
I was able to implement them seperately and union them.
I was more looking for a comprehensive solution to reduce the number of lines that I have to maintain...
Thanks in advance
Edited by: user566193 on Jan 15, 2010 1:58 PM -
Need helping in writing query for finding percentage of duration
Can any one please help in writing query for this.
The table is like this :-
ID Region Month Duration
I1 R1 Jan 80
I2 R2 Jan 70
I3 R1 Jan 70
I4 R3 Jan 40
I5 R1 Feb 80
I6 R2 Feb 30
I7 R3 Mar 100
I want to write a query to find
% of duration for each and every region against each and every month.
Please help in solving this query. I am in urgent need of this.
Thanks in advance.I also have to do in MS Access 2003You also have to ask into an other forum since here it's an Oracle forum, to try to find Oracle solution.
Nicolas. -
QUERY FOR FINDING SECOND HIGEST SALARY IN EACH DEPARTMENT...?
Hi ,
if anyone know query..please mail to my id ...[email protected]Hi,
(a) Use the analytic DENSE_RANK function (or ROW_NUMBER, depending on how you want to treat ties) to number every row, showing how each one ranks within its deparment.
(b) Then choose the ones that were assigned 2 as their rank.
Step (a) will have to be done in a sub-query and step (b) in the main query, since analytic functions are computed after the WHERE-clause is done. -
Query for Finding the Daily Cumulative Production Total
Hi Experts,
I want Query based Report for finding Daily Cumulative i.e Running Production Total
Suppose Yesterdays Production for Item A0001 is 20 and Todays Prodction is 20 then it will show 50 but it shout be datewise selection.
Warm Regards,
Sandip KokateHello
Report Scenario as follow
Item Code Item name Todays Producion Yesterdays Production Total Productio
A001 Computer 20 20 40
A002 Mouse 10 05 15
A003 CPU 15 05 20
This is Exact Report
Regards,
Sandip Kokate -
Query For Finding Revised PO Amout in Purchasing in Each Revisions
Can anybody please tell me how
can i write a query for Extracting
individual PO amounts in each revisions of a
PO from PO_LINES_ARCHIEVE_ALL..
ie FOR Each revisions of a PO What was the total PO Amount
Regards
BinuHi Geoff,
You can use the ROW_NUMBER and CASE Functions to acheive this. Here with , i have give u a small idea with an ex:
Qry :
B.ItemCode,SUM(B.PO1)[PO1],SUM(B.POQty1)[POQty1],SUM(B.PO2)[PO2],SUM(B.POQty2)[POQty2] From
select Itemcode
CASE when Sno=1 Then DocNum End [PO1]
CASE When Sno=1 Then Qty End [POQty1]
CASE when Sno=2 Then DocNum End [PO2]
CASE When Sno=2 Then Qty End [POQty2]
From(
Row_Number() Over (Order By Opor.Docnum) [Sno], Opor.DocNum,POr1.ItemCode,sum(POr1.Quantity)[Qty] from OPOR join Por1 on Opor.DocEntry=por1.DocEntry
ItemCode='20002' group by oPor.DocNum,por1.ItemCode
A where A.Sno<=2)B Group By B.ItemCode
Result :-
ItemCode PO1 POQty1 PO2 POQty2
20002 18 1.000000 19 10.000000
Thanks,
Karthikeyan.P -
Hello,
I have a problem querying for the id-Attribute. I guess the solution is simple but I just don't get it %). Could someone give me a hint on that?
Xml-Snippet
<s xml:id="s100" n="s99"/>
I can successfully query the document for the sentence //s[@xml:id="s100"]
I can also query for the n-Attribute: //s/@n
But when I want to query for the xml:id attribute I get no results (and no error): //s/@xml:id
//s/@id does not work either.
What am I doing wrong?
Best wishes,
Peter
Edited by: user524194 on Nov 17, 2009 1:10 AM
Edited by: user524194 on Nov 17, 2009 1:11 AMHi Peter,
I'm afraid I'm not sure what's going on. You'll need to answer a few more questions:
1) What indexes do you have?
2) What storage and indexing model are you using (document or node)?
3) What is the full query that you're using?
4) What's the query plan for your query?
5) Can you reproduce the problem with a minimal data set via the DB XML shell?
John -
Script or GREP search line for missing quotation marks (opening or closing)
Hi there,
I've being trying to figure out a GREP search that will help me find quotations that haven't been opened or closed properly. Does anyone know if there exists a script that will mark/help me find the quotation marks that incorrectly stand alone? A GREP search line would be fine too.
Following is an example - just to make sure I made myself clear:
'why is the closing quotation mark missing after the question mark? I asked.
'I don't know, this line seems to be fine, with opening and closing quotation mark,' I answered.
Although this line is missing an opening quotation mark.'
Hope somebody can help me, I'm pretty sure I'm not the first person searching for a solution on this issue - sorry, I'm not to bright with scripting or GREP.
Thnx.
GijsAs you say, it's not waterproof, but it is really helpfull, thanks. The unclosed quotation are easy to find this way.
In Dutch we mainly use single quotation marks (double quotation marks are only used for quotations within quotations). This brings an extra dimension to the issue, since the apostrophe and single quotation mark are the same character. So a phrase like ' I'm having problems finding unopened quotations' with your GREP suggestion will mark the apostrophe in I'm as the closing quotation mark.
So what I'll do is:
1. find unclosed quotations ‘[^’]+?‘ and mark them with a character style WARNING;
2. GREP search ’[^‘]+?’ two following closing quotation marks and make them C=100;
3. GREP search ’[^‘’]+?’ the correct quotations and mark it all K=100;
4. Do a regular search for '^$ any apostrophe/quotation mark followed by a letter and mark them all K=100;
5. Do a regular search for any closing quotation mark left in C=100 and manually WARNING-mark the ones that need to be looked at by the editor.
Step 4 is a bit tricky since any error like 'I agree,'he said (no space after quotation mark) will be marked back to K=100 as well, but those errors I'll probably notice since they're underlined by the grammar control option.
Thanks again for the help.
Maybe you are looking for
-
my itunes is not working at all. A message pops up to say that I may not have suffient privileges to start system services on my apple mobile device. I have uninstalled and reinstalled itunes but the same message still appears and itunes will not st
-
How to authorize songs from ITunes account that no longer exists
I have 26 songs in my iTunes library that I cannot play on my iMac and cannot synch with my 2nd gen Nano because they are not authorized for this computer. These files were purchased under an account that no longer exists, on a Windows computer I no
-
Drop Command taking considerable time!!!
Hi guys, In the morning i had asked u alll about Truncate command taking time. I used "Truncate <table> reuse storage" for truncating the table. It worked fine. Now, when i'am dropping that same table due to some change in our plan, this is also taki
-
Hi, I want to put a defaullt Delivery block in sales order if the material is changed. if sy-tcode = 'VA02'. if xvbap-matnr ne yvbap-matnr. vbak-lifsk = '40'. '40 is a Delivery block endif. endif. with this, the block is placed when the material is c
-
I've got a RH X5 project here, and I'm publishing FlashHelp files. Over the course of development, I've added, deleted, and moved topics and folders within the HTML Files folder on the Project tab. A lot of times, when I'd add a new topic, it would b