Convert the SQL query to Oracle
Hi allI have two SQL queries to create the table.
Query1.
CREATE TABLE [dbo]. [DocumentType] (
[DocType] [varchar] (20) GATHER SQL_Latin1_General_CP1_CI_AS NOT NULL,.
[SubCat] [varchar] (20) GATHER SQL_Latin1_General_CP1_CI_AS NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo]. [DocumentType] ADD
CONSTRAINT [PK_DocumentType] PRIMARY KEY CLUSTER
(
[DocType],
[SubCat]) ON [PRIMARY]
Query2.
CREATE TABLE [dbo]. [SBU] (
[SBU] [varchar] (51) GATHER SQL_Latin1_General_CP1_CI_AS NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo]. [SBU] ADD
[PK_SBU] CLUSTERED PRIMARY KEY CONSTRAINT
(
[SBU]
) ON [PRIMARY]
What will be the query in Oracle?
Please suggest!
Kind regards
Shah
Query1.
CREATE TABLE dbo. DocumentType)
DocType varchar2 (20) NOT NULL,
SubCat varchar (20) NOT NULL,
CONSTRAINT PK_DocumentType PRIMARY KEY (DocType, SubCat)
)
/
Query2.
CREATE TABLE dbo. SBU)
SBU varchar2 (51),
CONSTRAINT PK_SBU PRIMARY KEY (UDF)
)
/
It is useful for you?
Published by: insa on June 12, 2012 22:42
Tags: Database
Similar Questions
-
convert the access query to oracle sql
I'm trying to convert this query MS Access to oracle sql:
Sum (IIf (IsNull ([INV_MTL_MATERIAL_TRANSACTIONS1]! [PRIMARY_QUANTITY]), 0,-[INV_MTL_MATERIAL_TRANSACTIONS1]! [PRIMARY_QUANTITY])) AS PRIMARY_QTY
I tried to convert myself but still no luck. Invalid number of arguments.
Sum (if (NVL (INV. MTL_MATERIAL_TRANSACTIONS1. PRIMARY_QUANTITY), 0,-INV. MTL_MATERIAL_TRANSACTIONS1. PRIMARY_QUANTITY)) AS PRIMARY_QTY
Can someone help me convert this request? Thank you.
The immediate if (IIF) statement said:
If primary_quantity is null return 0 for another return negative primary_quantity.
Since there is no difference at all between 0 and - 0 I would write it as:
sum (nvl (primary_quantity, 0) * - 1).
Change a minute later, never send before thinking.
Because you are just adding up the values obtained, he must not care about NULL values at all as aggregate functions generally ignore nulls, it should just be:
Sum (primary_quantity * - 1).
John
-
Convert the Sql for Oracle script
Could someone help me convert the sql script in oracle below
-- EXEC SP_smpAGENCY_MYWS_LAPSE_GET_USP_AMSurrenderMngtReport '2005','2010','09048','IL' ALTER PROCEDURE SP_smpAGENCY_MYWS_LAPSE_GET_USP_AMSurrenderMngtReport --DECLARE @StartYY AS VARCHAR(4), @EndYY AS VARCHAR(4), @AgentCode AS VARCHAR(9), @CompanyCode AS VARCHAR(4) AS DECLARE @ProfileYYYYMM AS VARCHAR(6), @SQLStr1 AS VARCHAR(8000),@SQLStr2 AS VARCHAR(8000), @SQLStr3 AS VARCHAR(8000) SET @ProfileYYYYMM = '201005' SET @SQLStr1 = '' SET @SQLStr1 = @SQLStr1 + ' DECLARE @CompAvgCount AS DECIMAL(38,2), @CompAvgAP AS DECIMAL(38,2), @CompInforceAP AS DECIMAL(15,2), @CompSurrenderAP AS DECIMAL(15,2), ' SET @SQLStr1 = @SQLStr1 + ' @CompInforceCount NUMERIC, @CompSurrenderCount NUMERIC,@ALCompInforceAP AS DECIMAL(15,2), @ALCompSurrenderAP AS DECIMAL(15,2), ' SET @SQLStr1 = @SQLStr1 + ' @ALCompInforceCount NUMERIC, @ALCompSurrenderCount NUMERIC,@ILCompInforceAP AS DECIMAL(15,2), @ILCompSurrenderAP AS DECIMAL(15,2), ' SET @SQLStr1 = @SQLStr1 + ' @ILCompInforceCount NUMERIC, @ILCompSurrenderCount NUMERIC ' SET @SQLStr1 = @SQLStr1 + ' DECLARE @tblAgentNumber TABLE ' SET @SQLStr1 = @SQLStr1 + ' ( ' SET @SQLStr1 = @SQLStr1 + ' [AgentName] VARCHAR(255), ' SET @SQLStr1 = @SQLStr1 + ' [AgentNumber] VARCHAR(9), ' SET @SQLStr1 = @SQLStr1 + ' [AgentRank] VARCHAR(10) ' SET @SQLStr1 = @SQLStr1 + ' ) ' SET @SQLStr1 = @SQLStr1 + ' DECLARE @tblmineInForce TABLE ' SET @SQLStr1 = @SQLStr1 + ' ( ' SET @SQLStr1 = @SQLStr1 + ' [company_code] VARCHAR(50), ' SET @SQLStr1 = @SQLStr1 + ' [mine_policy_no] VARCHAR(50), ' SET @SQLStr1 = @SQLStr1 + ' [Annl_premium] NUMERIC(28, 2) ' SET @SQLStr1 = @SQLStr1 + ' ) ' SET @SQLStr1 = @SQLStr1 + ' DECLARE @tblmineSurrender TABLE ' SET @SQLStr1 = @SQLStr1 + ' ( ' SET @SQLStr1 = @SQLStr1 + ' [company_code] VARCHAR(50), ' SET @SQLStr1 = @SQLStr1 + ' [mine_policy_no] VARCHAR(50), ' SET @SQLStr1 = @SQLStr1 + ' [Annl_premium] NUMERIC(28, 2) ' SET @SQLStr1 = @SQLStr1 + ' ) ' SET @SQLStr1 = @SQLStr1 + ' INSERT INTO @tblAgentNumber ' SET @SQLStr1 = @SQLStr1 + ' SELECT AgentName, AgentNumber, AgentRank ' SET @SQLStr1 = @SQLStr1 + ' FROM [SUMYOLAP0001].aetnaildb.dbo.agentprofile'+ @ProfileYYYYMM +' AgtProfile ' SET @SQLStr1 = @SQLStr1 + ' WHERE (LEN(agentnumber) = 5 and (left(agentnumber,1) between ''0'' and ''8'' or left(agentnumber,1) = ''A'')) ' SET @SQLStr1 = @SQLStr1 + ' AND (Amname not like ''%COMPANY%'' OR Amname not like ''%DIRECT%'' OR Amname not like ''%MARKETsmp%'') ' SET @SQLStr1 = @SQLStr1 + ' AND agencynumber not in (''ILS'',''PLS'',''99999'') ' SET @SQLStr1 = @SQLStr1 + ' AND LEFT(agencynumber,2) not in (''CD'',''DR'') AND LEFT(agencynumber,3) <> ''DIR'' ' SET @SQLStr1 = @SQLStr1 + ' AND RIGHT(RTRIM(agencynumber),2) not in (''CD'',''DR'') AND RIGHT(RTRIM(agencynumber),3) <> ''DIR'' ' SET @SQLStr1 = @SQLStr1 + ' AND companycode = ''IL'' ' SET @SQLStr1 = @SQLStr1 + ' INSERT INTO @tblmineSurrender ' SET @SQLStr1 = @SQLStr1 + ' SELECT company_code, mine_policy_no, Annl_premium ' SET @SQLStr1 = @SQLStr1 + ' FROM odsmine_policy ' IF @CompanyCode = 'All' BEGIN SET @SQLStr1 = @SQLStr1 + ' WHERE company_code IN (''IL'',''AL'') ' END ELSE BEGIN SET @SQLStr1 = @SQLStr1 + ' WHERE company_code IN ('''+ @CompanyCode +''') ' END SET @SQLStr1 = @SQLStr1 + ' AND cont_status = ''S'' ' SET @SQLStr1 = @SQLStr1 + ' AND YEAR(effective_date) BETWEEN '+ @StartYY +' AND '+ @EndYY +' ' SET @SQLStr1 = @SQLStr1 + ' SELECT @CompSurrenderCount = COUNT(1), @CompSurrenderAP = SUM(Annl_premium) ' SET @SQLStr1 = @SQLStr1 + ' FROM @tblmineSurrender S ' SET @SQLStr1 = @SQLStr1 + ' INNER JOIN odsagent_role R ' SET @SQLStr1 = @SQLStr1 + ' ON S.company_code = R.company_code ' SET @SQLStr1 = @SQLStr1 + ' AND S.mine_policy_no = R.mine_policy_no ' SET @SQLStr1 = @SQLStr1 + ' INNER JOIN @tblAgentNumber A ' SET @SQLStr1 = @SQLStr1 + ' ON R.servicsmpagent_code = A.AgentNumber ' SET @SQLStr1 = @SQLStr1 + ' INSERT INTO @tblmineInforce ' SET @SQLStr1 = @SQLStr1 + ' SELECT company_code, mine_policy_no, Annl_premium ' SET @SQLStr1 = @SQLStr1 + ' FROM odsmine_policy ' IF @CompanyCode = 'All' BEGIN SET @SQLStr1 = @SQLStr1 + ' WHERE company_code IN (''IL'',''AL'') ' END ELSE BEGIN SET @SQLStr1 = @SQLStr1 + ' WHERE company_code IN (''' + @CompanyCode + ''') ' END SET @SQLStr1 = @SQLStr1 + ' AND cont_status = ''I'' ' SET @SQLStr1 = @SQLStr1 + ' AND YEAR(effective_date) BETWEEN '+ @StartYY +' AND '+ @EndYY +' ' SET @SQLStr1 = @SQLStr1 + ' SELECT @CompInforceCount = COUNT(1), @CompInforceAP = SUM(Annl_premium) ' SET @SQLStr1 = @SQLStr1 + ' FROM @tblmineInforce I ' SET @SQLStr1 = @SQLStr1 + ' INNER JOIN odsagent_role R ' SET @SQLStr1 = @SQLStr1 + ' ON I.company_code = R.company_code ' SET @SQLStr1 = @SQLStr1 + ' AND I.mine_policy_no = R.mine_policy_no ' SET @SQLStr1 = @SQLStr1 + ' INNER JOIN @tblAgentNumber A ' SET @SQLStr1 = @SQLStr1 + ' ON R.servicsmpagent_code = A.AgentNumber ' SET @SQLStr1 = @SQLStr1 + ' SET @CompAvgCount = ROUND(ISNULL(@CompSurrenderCount,0) * 100 / ( ISNULL(@CompSurrenderCount,0) + @CompInforceCount),2) ' SET @SQLStr1 = @SQLStr1 + ' SET @CompAvgAP = ROUND(ISNULL(@CompSurrenderAP,0) * 100 / ( ISNULL(@CompSurrenderAP,0) + @CompInforceAP),2) ' SET @SQLStr1 = @SQLStr1 + ' DECLARE @tblODSmine_Policy TABLE ' SET @SQLStr1 = @SQLStr1 + ' ( ' SET @SQLStr1 = @SQLStr1 + ' [AgentName] VARCHAR(255), ' SET @SQLStr1 = @SQLStr1 + ' [AgentNumber] VARCHAR(9), ' SET @SQLStr1 = @SQLStr1 + ' [AgentRank] VARCHAR(10), ' SET @SQLStr1 = @SQLStr1 + ' [Company_Code] VARCHAR(4), ' SET @SQLStr1 = @SQLStr1 + ' [mine_Policy_No] VARCHAR(10), ' SET @SQLStr1 = @SQLStr1 + ' [Cont_Status] VARCHAR(1), ' SET @SQLStr1 = @SQLStr1 + ' [Annl_Premium] DECIMAL(15,2), ' SET @SQLStr1 = @SQLStr1 + ' [No_count] NUMERIC ' SET @SQLStr1 = @SQLStr1 + ' ) ' SET @SQLStr2 = 'INSERT INTO @tblODSmine_Policy ' SET @SQLStr2 = @SQLStr2 + ' SELECT DISTINCT AgtProfile.AgentName, AgtProfile.AgentNumber, ' SET @SQLStr2 = @SQLStr2 + ' AgtProfile.AgentRank,mine.company_code, mine.mine_policy_no, mine.cont_status, mine.Annl_Premium, 1.0 as no_count ' SET @SQLStr2 = @SQLStr2 + ' FROM @tblAgentNumber AgtProfile ' SET @SQLStr2 = @SQLStr2 + ' INNER JOIN [SUMYOLAP0001].aetnaildb.dbo.COMAGH COMAGH ' SET @SQLStr2 = @SQLStr2 + ' ON AgtProfile.AgentNumber = COMAGH.AHAGTN ' SET @SQLStr2 = @SQLStr2 + ' AND (AHAMNO = ''' + @AgentCode + ''' OR AHUMNO = ''' + @AgentCode + ''' OR AHAGNO = ''' + @AgentCode + ''') ' IF @CompanyCode = 'ALL' BEGIN SET @SQLStr2 = @SQLStr2 + ' AND AHCO IN (''AL'',''IL'') ' END ELSE BEGIN SET @SQLStr2 = @SQLStr2 + ' AND AHCO = ''' + @CompanyCode + ''' ' END SET @SQLStr2 = @SQLStr2 + ' INNER JOIN odsagent_role Role ' SET @SQLStr2 = @SQLStr2 + ' ON AgtProfile.AgentNumber = Role.servicsmpagent_code ' SET @SQLStr2 = @SQLStr2 + ' INNER JOIN odsmine_policy mine ' SET @SQLStr2 = @SQLStr2 + ' ON Role.company_code = mine.company_code ' SET @SQLStr2 = @SQLStr2 + ' AND Role.mine_policy_no = mine.mine_policy_no ' SET @SQLStr2 = @SQLStr2 + ' AND mine.cont_status IN (''S'',''I'') ' IF @CompanyCode = 'ALL' BEGIN SET @SQLStr2 = @SQLStr2 + ' AND mine.company_code IN (''AL'',''IL'') ' END ELSE BEGIN SET @SQLStr2 = @SQLStr2 + ' AND mine.company_code = ''' + @CompanyCode + ''' ' END SET @SQLStr2 = @SQLStr2 + ' AND YEAR(mine.effective_date) BETWEEN '+ @StartYY +' AND '+ @EndYY +' ' SET @SQLStr3 = 'SELECT AgentName, AgentRank, AgentNumber, ' SET @SQLStr3 = @SQLStr3 + ' CONVERT(INT,SUM(CASE WHEN cont_status = ''S'' THEN no_count ELSE 0 END)) AS Surrrender_Count, ' SET @SQLStr3 = @SQLStr3 + ' CONVERT(INT,SUM(CASE WHEN cont_status = ''I'' THEN no_count ELSE 0 END)) AS InForce_Count, ' SET @SQLStr3 = @SQLStr3 + ' SUM(CASE WHEN cont_status = ''S'' THEN Annl_premium ELSE 0 END) AS SurrenderAP, ' SET @SQLStr3 = @SQLStr3 + ' SUM(CASE WHEN cont_status = ''I'' THEN Annl_premium ELSE 0 END) AS InForceAP, ' SET @SQLStr3 = @SQLStr3 + ' CASE WHEN count(*) = 0 THEN 0 ELSE CONVERT(DECIMAL(38,2),(SUM(CASE WHEN cont_status = ''S'' THEN no_count ELSE 0 END) * 100 / count(*))) END AS AgtSurrenderCount, ' SET @SQLStr3 = @SQLStr3 + ' CASE WHEN SUM(Annl_premium) = 0 THEN 0 ELSE CONVERT(DECIMAL(38,2),(SUM(CASE WHEN cont_status = ''S'' THEN Annl_premium ELSE 0 END) * 100 / SUM(Annl_premium))) END AS AgtSurrenderAP, ' SET @SQLStr3 = @SQLStr3 + ' CONVERT(varchar(100),@CompAvgCount) AS CompAvgCount, ' SET @SQLStr3 = @SQLStr3 + ' CONVERT(varchar(100), @CompAvgAP) AS CompAvgAP ' SET @SQLStr3 = @SQLStr3 + ' FROM @tblODSmine_Policy ' SET @SQLStr3 = @SQLStr3 + ' GROUP BY AgentName, AgentRank, AgentNumber ' EXEC (@SQLStr1 + @SQLStr2 + @SQLStr3) --PRINT (@SQLStr1 + @SQLStr2 + @SQLStr3)
Yes.
1. the scrap code.
2. get the specification of the requirements of business origin.
3. learn PL/SQL.
4. write the PL/SQL code to meet the requirements of the company. -
How to convert the hierarchical query of SQL Server (CTE) to Oracle?
How to convert the hierarchical query of SQL Server (CTE) to Oracle?
WITH cte (col1, col2) AS
(
SELECT col1, col2
FROM dbo. [tb1]
WHERE col1 = 12
UNION ALL
SELECT c.col1, c.col2
FROM dbo. [tb1] AS c INNER JOIN cte AS p ON c.col2 = p.col1
)
DELETE one
FROM dbo. [tb1] AS an INNER JOIN b cte
ON a.col1 = b.col1Hello
Something like this maybe:DELETE FROM dbo.tb1 a WHERE EXISTS ( SELECT 1 FROM dbo.tb1 b WHERE a.co11 = b.col1 AND a.col2 = b.col2 START WITH b.col1 = 12 CONNECT BY b.col2 = PRIOR b.col1)
Although you need to do here is to check that CONNECT it BY SELECT, returns records you wait first, then the DELETION should work too.
-
Table error ' can not analyze the SQL query!
Hi all
I created a view on my database called VIEW_MEMBER_PARTIC_PROJECTS
If I run a query showing the results of the view:
SELECT * FROM VIEW_MEMBER_PARTIC_PROJECTS
I get the following data
Projects Participants 1 31 S 2 41 3 19 4 3 5 3 6 1 7 2 Now, I wanted to represent this diagram in the APEX so I created a graphic region and entered the Source query generator and the manufacturer produces the following code
Select null, label projects, value1 Participant link
of "SCHEMANAME." "" VIEW_MEMBER_PARTIC_PROJECTS ".
With this code, I get an error:
Cannot parse the SQL query!
Select the link null, label projects, value1 "SCHEMANAME Participant." "" VIEW_MEMBER_PARTIC_PROJECTS ".
Some queries can be run when you run your application, if your query is syntactically correct, you can save your query without validation (see options below the source of the query).
The code looks OK, but I do not see to save options as the error code is mentioned.
No one knows how to fix this?
Thank you
JaReg wrote:
I finally found the problem.
I looked at the code for the view and changed the start of:
CREATE OR REPLACE FORCE EDITIONABLE VIEW "SCHEMANAME." "" VIEW_MEMBER_PARTIC_PROJECTS "("Participant","Projects")
AS
TO
CREATE OR REPLACE VIEW "SCHEMANAME." "" VIEW_REPEAT_PARATIC ".
AS
And that seemed to fix it. I'm not entirely sure why though.
The view was created using the quoted identifiers for column names. This makes them sensitive and means that they must always be referenced using double quotes. In the absence of quotation marks, Oracle is not case insensitive and automatically converts all uppercase identifiers. The application of graph:
Select the link null, label projects, value1 "SCHEMANAME Participant." "" VIEW_MEMBER_PARTIC_PROJECTS ".
has therefore been interpreted by Oracle:
SELECT THE LINK NULL, LABEL, VALUE1 "SCHEMANAME PARTICIPANT PROJECTS." "" VIEW_MEMBER_PARTIC_PROJECTS ".
and PROJECTS and PARTICIPANT columns were not recognized because the columns defined for the view have been 'Participant' and 'projects '. The graphic request should have been:
Select the link null, the label of "Projects", "Participant" value1 "SCHEMANAME." "" VIEW_MEMBER_PARTIC_PROJECTS ".
As you have now discovered, quoted identifiers are a source of nothing but obscure bugs and should never be used for database objects. He also pointed out the reason why you should always use a standardized, form tiny, coding style as it is faster to type, easy to read and less prone to errors.
-
Hey guys,.
I'm using version 4.2.6 apex. The theme is 26.
IM also using Listener Oracle APEX.
I can print my classic report in PDF or CSV format.
But I need to export it as a .xls extension.
Report type: SQL (body of function from PL/SQL returning the SQL) query
I need is like this cause my 'where' clause type is dynamic.
Look at using this method: Tom's Blog: a non-standard export excel 2010 (.xlsx)
I do something similar for downloads to excel in my projects...
Thank you
Tony Miller
Software LuvMuffin
Ruckersville, WILL -
Clarification of the SQL query in 2 day + Guide APEX
I worked through the Oracle Database Express Edition 2 day + Application Express Developer's Guide, and try to decipher the SQL query in Chapter 4 (building your app).
The code is:
SELECT d.DEPARTMENT_ID,
d.DEPARTMENT_NAME,
(select count (*) from oehr_employees where department_id = d.department_id)
"Number of employees", he said.
substr (e.first_name, 1, 1) |'. ' || Select 'Name Manager',
c.COUNTRY_NAME 'place '.
OEHR_DEPARTMENTS d,
E OEHR_EMPLOYEES
OEHR_LOCATIONS l,
C OEHR_COUNTRIES
WHERE d.LOCATION_ID = l.LOCATION_ID
AND l.COUNTRY_ID = c.COUNTRY_ID
AND e.department_id = d.DEPARTMENT_ID
AND d.manager_id = e.employee_id
AND instr (superior (d.department_name), superior (nvl (:P2_REPORT_SEARCH,d.department_name))) > 0)
I don't know exactly what is happening in the last line. I think I understand what the different functions but I'm not clear on the use of the: P2_REPORT_SEARCH string.
What does this string? This code simply checking that d.department_name isn't NA?
I have SQL experience but am not very familiar with the Oracle PL/SQL implementation. Can someone please give me a brief breakdown that check is doing in the context of the overall query? The application seems to work even if the conditional statement is not included.
Thank you.
2899145 wrote:
Thanks for the reply. I apologize if the information I added was incomplete. The code came from the day 2 + Application Express (version 4.2) Developer Guide.
In the section 'your own Application of 4 Buuilding' https://docs.oracle.com/cd/E37097_01/doc.42/e35122/build_app.htm#TDPAX04000 , they describe the creation of a report
page that includes the "manager_id" and 'location_id '. The SQL query, I pasted above extracted from the data in other tables to substitute the real 'name of the Manager' and 'rent '.
for the corresponding ID values. It makes sense, and the part of the SQL query that explicitly doing this makes sense.
However, given that the document is a guide for the development of the APEX, I guess the command:
AND instr (upper (d.department_name), upper (nvl (:P2_REPORT_SEARCH,d.department_name))) > 0
done something valuable, and I do not recognize what is exactly the value.
From a practical point of view why would I need to include this conditional statement? Which only added to the application?
Looking at the guide in question, it is clear that the
AND instr(upper(d.department_name),upper(nvl(:P2_REPORT_SEARCH,d.department_name)))>0
the line is completely unnecessary in the context of this tutorial, and it can be removed. The search in the tutorial app page is implemented by using a report filter interactive rather than a P2_REPORT_SEARCH element, which does not seem to exist at all. (It's a quirk of the APEX that bind variable references to non-existent items are replaced with NULL silently rather than exceptions). I thought that perhaps it would be legacy code a version of the tutorial prior to the introduction of interactive reports at the APEX 3.1, but I can't find explicit instructions to create such an element of filter in the 3.0 tutorial. I guess it must have been automatically generated by the application wizard when you create a standard report page.
If you do not want to see the effect he would have (as described in the post above), leave it in the source report, add a text element of P2_REPORT_SEARCH, and a button "submit" on page 2 and experimenting to find different values of the element and clicking on the submit button...
-
problem with bind variables in the SQL query view object
Hi all
I use JDev 11.1.2.4.0.
I have a problem with bind variables in the SQL query view object.
This is my original SQL
SELECT sum(t.TIME) , t.legertype_id FROM LEDGER t WHERE t.nctuser_id = '20022' AND to_char(t.insertdate,'YYYYMMDD') in ('20130930','20130929') group by t.legertype_id
In my view .xml object query tab, I am writing this
SELECT sum(t.TIME) , t.legertype_id FROM LEDGER t WHERE t.nctuser_id = '20022' AND to_char(t.insertdate,'YYYYMMDD') in :dddd group by t.legertype_id
Davis here is a variable of Type liaison: String, updatable and necessary.
I try to deal with Davis as ('20130930 ', ' 20130929') hoping the view object, run as my original SQL.
But failed. The view object retrieves 0 line after that I run.
Why?
Thank you! ('2original SQL0130930', '20130929') ('20130930 ', ' 20130929')
A variable binding cannot be used as this is why you must use years table. Check decompilation binary ADF: using oracle.jbo.domain.Array with ViewCriteria to see a solution.
Timo
-
Failed to parse the SQL query by user
Hi all
in my application, I have a piece of text with a button "submit". In this article, I type a name and a report after the element region show me the result (s). This works for all my users (> 2000) perfectly, but that users become an error in the area of the report:
Failed to parse the SQL query:
ORA-01403: no data found
We try this with the same searchstring on the same computer/browser. If I connected the result is ok, if the logged on user, the error message appears. If I try this on the user's computer with me connected, ok result. If the user try this on another pc, error results.
I have a production and a developer workspace. In the developer workspace the user can try this perfectly without errors. That in the space of productive work, clear the error.
The SQL-Select in the ist verry simple reprirt:
Select id
name
raum
table
where instr (upper (name), upper (:P60_SEARCH)) > 0
However, all users can use this search box with report perfectly, only this one user has the error. There is no restrictions on this point or a State.
Can someone help me?Hi Carsten,
I don't think that there is a way to do it.
Could you please mark the correct and useful answers in this thread? Otherwise I'll never get near Andy ;) :)
Denes Kubicek
------------------------------------------------------------------------------
http://deneskubicek.blogspot.com/
http://www.Opal-consulting.de/training
http://Apex.Oracle.com/pls/OTN/f?p=31517:1
------------------------------------------------------------------------------ -
date picker default value appears only not in the sql query
Hello
I have a page as a table with a query similar to the following:
Select emp_name, salary of emp_table where (hire_date) trunc = trunc (to_date (:P42_START_DATE))
where P42_START_DATE is the name of a date picker.
I put the date picker, "only when the current value in session state is null" and the value of being "select trunc (next_day(sysdate,'MON')-7) from dual;"-essentially the Monday of the current week, the type of source. I updated the date to 5 selector and the sequence of the region 10. Now, when I opened this page, no data gets pulled. I checked the source of the page and the value of the entry date picker is used to "November 17, 2008", but is not somehow reflected in the sql query.
Data get retrieved if I put manually the date in the date picker, but I would like that it by default on Monday of this week. What I am doing wrong?
Thank youHello
>
"Article 1 of the Expression value is NULL" where is expression 1
P42_START_DATE
>Yes, that's correct - No. colon is required here as we don't not using the item as a variable binding, just name for the condition. In my tests, I put the calculation for:
Name of article: P31_HIREDATE (put your P42_START_DATE here instead)
Type: SQL query
Point calculation: before header
Calculation: SELECT TO_CHAR (TRUNC (SYSDATE, 'DAY'), 'DD-MON-RR') FROM DUALMy report SQL statement is:
SELECT EMPNO, ENAME, HIREDATE FROM EMP WHERE NVL(HIREDATE, TRUNC(SYSDATE)) < TO_DATE(:P31_HIREDATE,'DD-MON-RR')
My datepicker object has no special parameters - so:
Name: P31_HIREDATE
Display: Date Picker (DD-MON-RR)
Source: Only when...
Source type: static...
The source value or expression: (empty)
Default: (empty)And that's what I did to get: http://htmldb.oracle.com/pls/otn/f?p=55041:31
Change the date that you like or click Reset to clear the cache (the calculation will be then reset the date to the current date and refiltrer the report)
Andy
-
After migrating my APEX 4.1 application to a new environment, one classic report displays a "cannot parse the SQL query: ORA-00942: table or view does not exist" error when the page is displayed. Change the region to report SQL source to somehow (e.g., remove spaces, changing the order of the variables in the WHERE clause) immediately solves the problem, but by returning to the source of the region causes the report error again (the source region valid code without error, however).
Throw the error message:
Select v.id,
v.Col1
of view_vw v
where (: P1_FILTER is null or)
v.col2 = :P1_FILTER)
Do not throw error:
Select v.id,
v.Col1
of view_vw v
where (:P1_FILTER is null or)
v.col2 = :P1_FILTER)
Changing the order of column in the report has the same effect; i.e. He arranges, but return back to the original column order causes the error to display.
It's as if a cached result for the correct select statement used by the report is displayed. However, the application does not use the caching of page/region. Any ideas of what could be the cause?
He solved. Ultimately, all that was necessary was to clear the DB cache using:
alter system flush shared_pool;
-
How to select only the part by using the sql query
Hello
I have the task to retrieve only the integral of the input text by using the sql query.
The entry is as follows
Entry for the price setting
$12.5 (FYI without space)
$ 12.5 (FYI single space)
$ 12.5 (double space FYI)
$12.5 (FYI multiple space)
$12.5 (FYI multiple space)
Output expected of 12.5
The price is the type varchar2 column in the store_price table.
Please let me know how to achieve this.
Thanks in advance.
If this is always the case that you get a $ followed by a number of places, you can use something like:
Select to_number (ltrim ('$ 12.5',' $')) DOUBLE
or
SELECT ltrim ('$ 12.5',' $') OF double
but take care of your nls_numeric_character settings if they are defined so that, for example, a comma is the decimal separator, you will have a problem.
HTH
-
Hi all
Here is the sql query,
Select papf.employee_number,
-papf.full_name, ppa.effective_date, pp.payroll_name,
PET.element_name,
PIV. Name input_value,
prrv.result_value
-, ppa.payroll_action_id, ppa.time_period_id
Of
Apps.pay_payroll_actions App,
pay_assignment_actions AAP,
pay_payrolls_f pp,
pay_run_results prr,
prrv pay_run_result_values,
pay_input_values_f piv,
animal pay_element_types_f,
Apps.per_all_assignments_f ADP,
Apps.per_all_people_f women's wear
-where ppa.payroll_action_id =: payroll_action_id - give your payroll_action_id
where ppa.payroll_id =: payroll_id
and ppa.payroll_action_id =: payroll_action_id
- and paa.assignment_action_id =: assignment_action_id
and ppa.payroll_action_id = paa.payroll_action_id
and ppa.payroll_id = pp.payroll_id
and paa.assignment_action_id = prr.assignment_action_id
and prr.run_result_id = prrv.run_result_id
and prrv.input_value_id = piv.input_value_id
and piv.element_type_id = pet.element_type_id
and paaf.assignment_id = paa.assignment_id
and paaf.person_id = papf.person_id
and trunc (sysdate) between pp.effective_start_date and pp.effective_end_date
and trunc (sysdate) between pet.effective_start_date and pet.effective_end_date
and trunc (sysdate) between piv.effective_start_date and piv.effective_end_date
and trunc (sysdate) between paaf.effective_start_date and paaf.effective_end_date
and trunc (sysdate) between papf.effective_start_date and papf.effective_end_date
- and papf.employee_number = '1'
- and ppa.effective_date = July 22, 2014"
and pet.element_name in ('Local Mission allowance', "Compensation of Mission International")
order by 1.3
The result is:
Employee_number Element_Name Input_Value Result_value
1 compensation of Mission international day amount 1000
1 compensation of international Mission Distance days 4
1 value to pay compensation of 1200 International Mission
1 International Mission allowance Start Date 01/01/2014
1 compensation of Mission international day amount 800
1 compensation of international Mission Distance days 10
1 International Mission allowance pay value 2000
1 International Mission allowance Start Date 01/02/2014
1 compensation of Mission local day amount 500
1 compensation of local Mission Distance days 10
1 Mission allowance paid local value 1000
1 compensation of local Mission Start Date 01/11/2014
Desired output:
Employee_number Element_Name Day_Amount Distance_Days Pay_Value Start_Date
1 compensation of international Mission 1000, 1200 4 2014/01/01
1
International Mission allowance 800 10 2000 01/02/2014 1 Mission local compensation 500 10 1000 01/11/2014 Please suggest.
INSERT statement:
TOGETHER TO DEFINE
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('1', 'International Mission allowance', 'Day amount', '1000');
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('1', 'International Mission allowance', 'Day amount', '1000');
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('1', 'International Mission allowance', 'number of orders', '196');
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('1', 'International Mission allowance', 'number of orders', '195');
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('1', 'International Mission allowance', ' Distance days, 4 ");
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('1', 'International Mission allowance', ' Distance days, 1 ");
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
("1', 'International Mission allowance', 'employee Category", "scale of employment medical cities");
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
("1', 'International Mission allowance', 'employee Category", "scale of employment medical cities");
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('1', 'International Mission allowance', 'Class level', 'G3');
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('1', 'International Mission allowance', 'Class level', 'G3');
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('1', 'International Mission allowance', 'class of employment, ' ');
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('1', 'International Mission allowance', 'class of employment, ' ');
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('1', 'International Mission allowance', 'Country of Mission', ' 3003 - Kuwait ");
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('1', 'International Mission allowance', 'Country of Mission', ' 2004 - Canada ");
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('1', 'International Mission allowance', ' Mission days, 4' ");
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('1', 'International Mission allowance', ' Mission days, 3' ");
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('1', 'compensation of Mission international","End of Mission Date"' 2014/07/10 00:00:00 ');
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('1', 'compensation of Mission international","End of Mission Date"' 2014/07/19 00:00:00 ');
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('1', 'compensation of Mission international", 'Mission Start Date', ' 2014/07/07 00:00:00 ');
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('1', 'compensation of Mission international", 'Mission Start Date', ' 2014/07/17 00:00:00 ');
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('1', 'International Mission allowance', 'value of pay', '3000');
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('1', 'International Mission allowance', 'value of pay', '4000');
00:00 ');
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('70', 'Local Mission allowance', 'number of orders', '45');
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('70', 'Local Mission allowance', 'number of orders', "456789");
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('70 ', 'local Mission allowance', ' away days '0' ");
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('70 ', 'local Mission allowance', ' Distance days, 1 ");
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('70 ', 'local Mission allowance', 'Provided food', 'Y');
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('70', 'compensation of local Mission","Accommodation provided", 'Y');
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('70', 'compensation of local Mission","Accommodation provided", 'Y');
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('70 ', "local Mission allowance", "Mission City", "AL MEDINA");
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('70 ', "local Mission allowance", "Mission City", "RIYADH");
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('70 ', 'local Mission allowance', ' Mission days, 4' ");
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('70 ', 'local Mission allowance', ' Mission days, 5' ");
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('70', 'Local Mission allowance', 'End of Mission Date' ' 2014/06/16 00:00:00 ');
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('70', 'Local Mission allowance', 'End of Mission Date' ' 2014-06-14 00:00:00 ');
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('70', 'Local Mission allowance', 'Mission Start Date', ' 2014/06/13 00:00:00 ');
Insert into APPS. PER_ALL_PEOPLE_F
(EMPLOYEE_NUMBER, NOM_ELEMENT, INPUT_VALUE, RESULT_VALUE)
Values
('70', 'Local Mission allowance', 'Mission Start Date', ' 2014/06/10 00:00:00 ');
Thank you very much in advance.
Kind regards
Afzal.
So then... something like this:
SELECT employee_number
element_name
MAX (decode (input_value, 'Day amount', result_value)) AS day_amount
MAX (decode (input_value, 'Days of Distance', result_value)) AS Distance_Days
, MAX (decode (input_value, 'Value of pay', result_value)) AS Pay_Value
MAX (decode (input_value, 'Start Date', result_value)) AS Start_Date
from (SELECT papf.employee_number
pet.element_name
piv.NAME input_value
prrv.result_value
prrv.run_result_id
OF apps.pay_payroll_actions App
pay_assignment_actions PAA
pay_payrolls_f pp
pay_run_results prr
pay_run_result_values prrv
pay_input_values_f piv
pay_element_types_f pet
apps.per_all_assignments_f ADP
apps.per_all_people_f women's wear
-where ppa.payroll_action_id =: payroll_action_id - give your payroll_action_id
WHERE ppa.payroll_id =: payroll_id
AND ppa.payroll_action_id =: payroll_action_id
- and paa.assignment_action_id =: assignment_action_id
AND ppa.payroll_action_id = paa.payroll_action_id
AND ppa.payroll_id = pp.payroll_id
AND paa.assignment_action_id = prr.assignment_action_id
AND prr.run_result_id = prrv.run_result_id
AND prrv.input_value_id = piv.input_value_id
AND piv.element_type_id = pet.element_type_id
AND paaf.assignment_id = paa.assignment_id
AND paaf.person_id = papf.person_id
AND trunc (sysdate) BETWEEN pp.effective_start_date AND pp.effective_end_date
AND trunc (sysdate) BETWEEN pet.effective_start_date AND pet.effective_end_date
AND trunc (sysdate) BETWEEN piv.effective_start_date AND piv.effective_end_date
AND trunc (sysdate) BETWEEN paaf.effective_start_date AND paaf.effective_end_date
AND trunc (sysdate) BETWEEN papf.effective_start_date AND papf.effective_end_date
AND pet.element_name IN ('local Mission allowance', 'International Mission'))
GROUP BY employee_number
element_name
run_result_id
;
You should get your desired result.
Roger
-
Hi all..
It's SOA 11.1.1.7... I created the schema and storage via RCU but when I try to configure JDBS schema components... his throw this error:
CFGFWK-60850: the Test failed!
CFGFWK-60853: A connection to the database, but no lines have been returned to the examination of the SQL query.
I created 3 users of UCR and who were all successful, because I have no error... of these three alone is managed in the configuration tree SOA...
No idea why like that...
Thank you
Aerts
This that I solved it by installing EMP 11.1.2.2 with UCR and SOA 11.1.1.6...
-
Format the results of the SQL query, currently, show as below.
Select license_type, correspondents of license_info where license_type in ('TEM', 'TDM') order by license_type;
TDM 1445140800000000000
TDM 1420952400000000000
TDM 1444363200000000000
TDM 1445054400000000000
TDM 1428724800000000000
TEM 1421125200000000000
TEM 1423890000000000000
TEM 1449637200000000000
TEM 1444968000000000000
TEM 1428724800000000000I need formatting like below
Expected result:
TDM 1445140800000000000 TEM 1421125200000000000
TDM 1420952400000000000 TEM 1423890000000000000
TDM 1444363200000000000 TEM 1449637200000000000
TDM 1445054400000000000 TEM 1444968000000000000
TDM 1428724800000000000 TEM 1428724800000000000I have sample data only, Blue said the change in your main table request
Try:
Select max (f1),
Max (F2),
Max (F3),
Max (F4)
de)
Select decode (license_type, 'TDM' license_type) f1,
Decode (license_type, 'TDM', expiration_date) f2,
Decode (license_type, 'TEM' license_type) f3,
Decode (license_type, 'TEM', expiration_date) f4,
ROW_NUMBER() over (partition by order correspondents license_type) r
Of
)
R group
----
Ramin Hashimzade
Maybe you are looking for
-
Unable to connect to iCloud library
After the update to iTunes 12.5.1, this error message pops up immediately. It keeps popping up and bugging me. Has anyone found a solution yet? I tried to sign and return, no help. Thanks for any help!
-
Using Mac OS X 10.6.8 Watch a slide show I Photo, in the middle of the show, I noticed that I couldn't stop the slide show (mouse is not responding, and I had to shut down the computer.) When I restarted and tried iPhoto he kept blocking and saying:
-
Not available for model hp 15-r006tu in the page to support wireless driver
I can't find the wireless driver software for the hp 15-r006tu model
-
Is there a size limit to file for the MP3 files on a Sandiak Clip +?
I bought the Clip + SanDisk so I could download radio 4 comedy programs to be able to listen to them during long car transfers. However, even if I can download files of any size and to see through my computer, I am not able to see the files via the C
-
Dell - bad logonui.exe laptop image
Hello, I have a Dell laptop and when I start it in the turn, before he arrived at the login screen, a mistake similar pop message and says the following... "LogonUI.exe - Bad Image". C:\Windows\systems32\avrt.dll is not designed to run on Windows or