Insert missing expression error
I am trying to insert data into sql plus and I keep getting this error. I am new at this and have no idea what I am doing wrong. Could someone please help!
here is the table I am inserting:
Name Null? Type
MANUFACTURER_ID NOT NULL NUMBER
M_NAME VARCHAR2(30)
STREET VARCHAR2(30)
CITY VARCHAR2(30)
STATE VARCHAR2(20)
COUNTRY VARCHAR2(30)
WEBSITE VARCHAR2(50)
EMAIL VARCHAR2(50)
FAX VARCHAR2(15)
I am inserting these values:
SQL> insert into manufacturer values(9185247,rollinsonlightsportaircraft,route2box186, bloomfield_in_47424, In, US, 'www.eurofox-use.com','[email protected]', 8123840518);
insert into manufacturer values(9185247,rollinsonlightsportaircraft,route2box186, bloomfield_in_47424, In, US, 'www.eurofox-use.com','[email protected]', 8123840518)
ERROR at line 1:
ORA-00936: missing expression
I have been working on this forever and I am just not getting it. Please help!
Now I am working on a different table and I am getting the error on a number attribute. Any ideas: here is the info.
Name Null? Type
DESIGN_ID NOT NULL NUMBER
MANUFACTURER_ID NUMBER
ENGINE_ID NUMBER
DESIGN_NAME VARCHAR2(20)
MAX_SPEED NUMBER
CRUISE_SPEED NUMBER
LD VARCHAR2(10)
MINSINK NUMBER
ASPECT_RATIO VARCHAR2(10)
RANGE NUMBER
CLIMB_RATE NUMBER
TAKEOFF_D NUMBER
LANDING_D NUMBER
SERVICE_CEIL NUMBER
EMPTY_WEIGHT NUMBER
GROSS_WEIGHT NUMBER
USEFUL_WEIGHT NUMBER
HEIGHT NUMBER
LENGTH NUMBER
WINGSPAN NUMBER
WINGAREA NUMBER
FUEL_CAPACITY NUMBER
WINGFOLD NUMBER
GEAR VARCHAR2(30)
HOUR_BUILD NUMBER
BUILT VARCHAR2(20)
INFO_PACKET VARCHAR2(10)
COST_OF_PLANS NUMBER
KIT_COST NUMBER
QB_COST NUMBER
PLAN_COST NUMBER
LDA VARCHAR2(20)
P_CURRENT NUMBER
CABIN_WIDTH NUMBER
QB_BUILDTIME VARCHAR2(20)
BUILD_COSTLOW NUMBER
BUILD_COSTHIGH NUMBER
SEATS VARCHAR2(20)
SQL> insert into plane values(20260,90300,148,'BushCaddy L162 Max',140,125,'',,'',720,1300,380,500,14000,1250,2650,1400,8,238,36,189,60,,'tailwheel',1200,'12','25',0,354030,0,'',1,47,'300',60000,110000,'2+2');
insert into plane values(20260,90300,148,'BushCaddy L162 Max',140,125,'',,'',720,1300,380,500,14000,1250,2650,1400,8,238,36,189,60,,'tailwheel',1200,'12','25',0,354030,0,'',1,47,'300',60000,110000,'2+2')
ERROR at line 1:
ORA-00936: missing expression
The * is falling under the cruise speed variable or minisink. but they are both number.
Similar Messages
-
ORA-00936:missing expression Error
I have what I would think was a simple SQL for Excel; but for some reason I keep getting the ORA-00936 missing expression error message.
The SELECT AND FROM of the SQL are no problem. It's the Where portion of the SQL statement where it messes up. I have many user input required parameters. But I tested out the same SQL statement in Toad for Oracle and it worked fine.
I'm wondering at this point if it's just too much for Excel.
Here's the code from the "Where" portion of the SQL that worked in Toad for Oracle. I believe I have to change some of the syntax to get it to work in Excel; and I'm wondering if anyone knows the true correct way to do this. Because I'm also wondering if that's where I'm going wrong.
Anyway, here's the code:
WHERE ( (a_compl_summary.product_division = 'CP')
AND ( a_compl_summary.entry_date >= :date1
AND a_compl_summary.entry_date <= :date2
AND ( a_compl_summary.product_family LIKE :pf1
OR a_compl_summary.product_family LIKE :pf2
OR a_compl_summary.product_family LIKE :pf3
OR a_compl_summary.product_family LIKE :pf4
OR a_compl_summary.product_family LIKE :pf5
AND (a_compl_summary.region = :r1)
AND ( a_compl_summary.NAME = :c1
OR a_compl_summary.NAME = :c2
OR a_compl_summary.NAME = :c3
OR a_compl_summary.NAME = :c4
OR a_compl_summary.NAME = :c5
AND (a_compl_summary.complaint = :yorn)
AND ( rp_qa_reported_device_codes.reported_dev_clarification LIKE
:cl1
OR rp_qa_reported_device_codes.reported_dev_clarification LIKE
:cl2
OR rp_qa_reported_device_codes.reported_dev_clarification LIKE
:cl3
OR rp_qa_reported_device_codes.reported_dev_clarification LIKE
:cl4
OR rp_qa_reported_device_codes.reported_dev_clarification LIKE
:cl5
AND (rp_qa_reported_device_codes.reported_dev_clarification NOT LIKE
:dc1
AND (a_compl_summary.incident_number =
rp_qa_patient_codes.incident_number
AND (a_compl_summary.case_number = rp_qa_patient_codes.case_number)
AND (a_compl_summary.part_sequence = rp_qa_patient_codes.part_sequence
AND (a_compl_summary.incident_number =
rp_qa_reported_device_codes.incident_number
AND (a_compl_summary.case_number =
rp_qa_reported_device_codes.case_number
AND (a_compl_summary.part_sequence =
rp_qa_reported_device_codes.part_sequence
AND (rp_qa_reported_device_codes.incident_number =
rp_qa_patient_codes.incident_number
AND (rp_qa_reported_device_codes.case_number =
rp_qa_patient_codes.case_number
AND (rp_qa_reported_device_codes.part_sequence =
rp_qa_patient_codes.part_sequence
)But are the ":parameter1" okay, or do I need to change the syntax for Excel?
Because when I change the[b] :parameter to just a ? it ends up working to a degree. When I have too many parameters Excel ends up bailing on me with a Debug, Send Error Report box popping up. -
ORA-00936 Missing expression - error in composite statement
I'm using the following statement to call a function which uses a number retrieved from a table i.e.
SELECT GETNEXTBUSINESSDATE(TO_DATE('28/08/2003','dd/mm/yyyy'), TO_NUMBER(SELECT VALUE1 FROM PARAMETERS WHERE PARCODE = 'CCR1' AND ATTRIBUTE1 = 'CCRNRQST1')) FROM DUAL;
The function adds the value store in the value1 field to a date to get the next buisness date. The above statement is giving me an ORA-00936 Missing expression error message.
Can anybody help ?We can't pass a query as a parameter.
You'll have to write a function that accepts PARCODE and ATTRIBUTE1 as parameters, or figure some other way of getting the value.
As I typed that, it occurred to me that this might work:
SELECT GETNEXTBUSINESSDATE(TO_DATE('28/08/2003','dd/mm/yyyy')
, x.val1)
FROM ( SELECT TO_NUMBER(VALUE1) as val1
FROM PARAMETERS
WHERE PARCODE = 'CCR1'
AND ATTRIBUTE1 = 'CCRNRQST1') x;I'm not guaranteeing anything as I've never tried running a function from an in-line view.
Cheers, APC -
Missing Expression error in query...
Hi,
SELECT DECODE(NAME, '~', '', NAME),
DECODE(NAME_2, '~', '', NAME_2),
DECODE(SALES_ORG_ID, '~', '', SALES_ORG_ID),
DECODE(PARTNER_ID, '~', '', PARTNER_ID)
FROM DMN_SALES_PARTNER
WHERE (
(upper(trim(country_name)),(trim(state_id))) IN
SELECT DISTINCT upper(trim(scsm.country_name)),upper(trim (scsm.state_name))
FROM sop_region_country_map srsm, sop_user_map smap,sop_country_state_map scsm
WHERE SSO_ID = '&sso_id' AND
upper(trim(smap.region_id)) = upper(trim(srsm.region_id)) AND
upper(trim(srsm.country_name)) = upper(trim(scsm.country_name)) AND
decode(upper(trim(srsm.state_name)),NULL,'~',upper(trim(srsm.state_name)) ) = upper(trim(scsm.state_name))
AND deviation_from_sap = 'N'
OR
SELECT upper(trim(scsm.country_name)),upper(trim(scsm.state_name))
FROM sop_country_state_map scsm
WHERE (upper(trim(scsm.country_name)),scsm.sap_state_map_id) in (
select upper(trim(scssm.country_name)),scssm.sap_state_map_id
from sop_country_state_sap_mapping scssm )
)I want to return the combination of country_name and state_name from any of the queries in OR clause so as to compare them with the country_name and state_id of main query..I have written the above query for it but its giving me "Missing Expression" error..
Pls help..
Thx
JPJP,
Your second part after the "OR" is just a SQL statement and it is not being compared to an expression. That's probably what the error message is telling you.
Regards,
Rob. -
OIM 11g - AD Organization Recon "missing expression" error
Hi,
I've got an environment with a OIM 11.1.1.5.2 installed with MSAD user management connector version 9.1.1.
Provisioning to Active Directory works just fine out of the box, however, we've run into a problem with the Organization Reconciliation Job (not the organization lookup reconciliation).
Every time i run the "AD Organization Recon" schedule task, the job ends succesfully and events are created for each AD org, but these events do not have any value on the "current status" field and no OIM organization is created.
Checking the logs, i can find the following error for each organization discovered for the connector:
[2012-04-04T10:06:19.647-03:00] [WLS_OIM1] [NOTIFICATION] [IAM-5010000] [oracle.iam.reconciliation.dao] [tid: [ACTIVE].ExecuteThread: '4' for
queue: 'weblogic.kernel.Default (self-tuning)'] [userId: oiminternal] [ecid: 58f980760a5e54af:-129c6f98:1367872b8db:-8000-0000000000000002,0
] [APP: oim#11.1.1.3.0] Generic Information: Insert into recon_org_match(act_key, re_key, rom_rowver) (SELECT act.act_key, RA_XELLERATE_ORG.r
e_key, '0' FROM act, RA_XELLERATE_ORG WHERE RA_XELLERATE_ORG.re_key = 99 and act.act_status != 'Deleted' AND )
[2012-04-04T10:06:19.648-03:00] [WLS_OIM1] [NOTIFICATION] [IAM-5010006] [oracle.iam.reconciliation.impl] [tid: [ACTIVE].ExecuteThread: '4' fo
r queue: 'weblogic.kernel.Default (self-tuning)'] [userId: oiminternal] [ecid: 58f980760a5e54af:-129c6f98:1367872b8db:-8000-0000000000000002,
0] [APP: oim#11.1.1.3.0] The following exception occurred: {0}[[
oracle.iam.platform.utils.SuperRuntimeException: java.sql.SQLSyntaxErrorException: ORA-00936: missing expression
at oracle.iam.reconciliation.dao.ReconActionDao.executeOrgMatch(ReconActionDao.java:1370)
at oracle.iam.reconciliation.impl.OrganizationHandler.executeSingleEventMatch(OrganizationHandler.java:34)
at oracle.iam.reconciliation.impl.EntityTypeHandler.process(EntityTypeHandler.java:38)
at oracle.iam.reconciliation.impl.ActionEngine.processEvent(ActionEngine.java:209)
This is not the first time this happens to us, just a month ago in a different environment, and working with OIM 11.1.1.5, we found the same problem. After reviewing everything we could thought of, we exported the Xellerate Organization.xml file from mds and found this:
<?xml version='1.0' encoding='UTF-8'?>
<reconConfig xmlns="http://www.oracle.com/schema/oim/recon/profile">
<generalconfig mode="CHANGELOG" createEntityUsingSPFlag="true" dateFormat="yyyy/MM/dd hh:mm:ss z" ownerMatchingRuleWhereClause="" entitytype="Organization" version="1.0" trustedSrcFlag="false" accountPostProcessingRequiredFlag="true" sequentialProcessingFlag="false" batchSize="-1" retryInterval="30" maxRetryCount="5" defaultProfileFlag="true" name="Xellerate Organization"/>
<singlevaluedreconeventdata>
<formInfo ostKey="0" sdkKey="2" objKey="3" latestFormVersion="0" activeFormVersion="0" objorderFor="O" objname="Xellerate Organization" sdkformName="ACT"/>
<matchingruleWhereClause>*((ACT.ACT_NAME=RA_XELLERATE_ORG.RECON_ORGANIZATIONSORGB111A46A))*</matchingruleWhereClause>
<reconFields>
<reconAttr>
We found that after adding the same rule on the element "matchingruleWhereClause" to the element "ownerMatchingRuleWhereClause" the reconciliation started working. At the time we thought that maybe we had modified some property on the design console and messed up the profile, or some bug that would be patched on 11.1.1.5.2, but now that we have a brand new patched installation we face the exact same situation.
Is this a common problem in 11.1.1.5? Is manually editing the xellerate organization profile supported? Maybe we are doing something wrong, but we've followed all OIM and AD connector guides, there's nothing there that says that we need to configure rules on the xellerate orgs resource before trying recon. We can reconcile using this workaround, but we do not want to move forward without knowing if something could go wrong down the line.
Thanks.Hi guys,
I'm experiencing the same problem? Does any one have any suggestions?
Thanks in advance... -
Missing Expression Error When Case Statment is used as field
I have tried to write an expression that will calculate how many days ago a request was submitted and return a user defined value if the calculation falls within the criteria in the case statment. The SQL View for the Query I am using is shown below:
SELECT A.F_POSN_REQUEST_ID, A.F_REQ_ECP_STATUS, TO_CHAR(A.REQUEST_DTTM,'YYYY-MM-DD-HH24.MI.SS."000000"'), TO_CHAR(A.F_REQ_ST_DT,'YYYY-MM-DD-HH24.MI.SS."000000"'), TO_CHAR(A.F_REQ_ECP_ST_DT,'YYYY-MM-DD-HH24.MI.SS."000000"'), TO_CHAR(A.F_REQ_ECP_PROC_DT,'YYYY-MM-DD-HH24.MI.SS."000000"'), CASE WHEN(sysdate - TO_DATE(SUBSTR( TO_CHAR(A.F_REQ_ST_DT,'YYYY-MM-DD-HH24.MI.SS."000000"'),1,16),'YYYY-MM-DD-HH24.MI'))>60 THEN '>60' ELSE(CASE WHEN(sysdate - TO_DATE(SUBSTR( TO_CHAR(A.F_REQ_ST_DT,'YYYY-MM-DD-HH24.MI.SS."000000"'),1,16),'YYYY-MM-DD-HH24.MI')) >30 AND <=60 THEN '30 - 60' ELSE(CASE WHEN(sysdate - TO_DATE(SUBSTR( TO_CHAR(A.F_REQ_ST_DT,'YYYY-MM-DD-HH24.MI.SS."000000"'),1,16),'YYYY-MM-DD-HH24.MI'))>=15 AND <=30 THEN '15 - 30' ELSE(CASE WHEN(sysdate - TO_DATE(SUBSTR( TO_CHAR(A.F_REQ_ST_DT,'YYYY-MM-DD-HH24.MI.SS."000000"'),1,16),'YYYY-MM-DD-HH24.MI'))<15 THEN 'Less Than 15' ELSE NULL END)END)END)END))
FROM PS_F_POSN_REQUEST A
WHERE A.F_REQ_ECP_STATUS IN ('I','O','P')
GROUP BY A.F_POSN_REQUEST_ID, A.F_REQ_ECP_STATUS, TO_CHAR(A.REQUEST_DTTM,'YYYY-MM-DD-HH24.MI.SS."000000"'), TO_CHAR(A.F_REQ_ST_DT,'YYYY-MM-DD-HH24.MI.SS."000000"'), TO_CHAR(A.F_REQ_ECP_ST_DT,'YYYY-MM-DD-HH24.MI.SS."000000"'), TO_CHAR(A.F_REQ_ECP_PROC_DT,'YYYY-MM-DD-HH24.MI.SS."000000"')When I try to run the query I get Message=ORA-00936: missing expression (50,380)
Any suggestions you could provide to help me clear this error would be greatly appreciated.
Edited by: 992737 on Mar 8, 2013 9:07 AMHi,
Welcome to the forum!
I think you want something like this:
CASE
WHEN a.f_req_st_dt < TRUNC (SYSDATE) - 60 THEN '>60'
WHEN a.f_req_st_dt < TRUNC (SYSDATE) - 30 THEN '30.1-60'
WHEN a.f_req_st_dt < TRUNC (SYSDATE) - 15 THEN '15.1-30'
WHEN a.f_req_st_dt < TRUNC (SYSDATE) THEN '15 or less'
ENDNested CASE expressions aren't needed very much. Each WHEN clause is evaluated only if all the ealier ones have failed. For example, when testing to see if a row is in the 301.-60 range above (that is, the 2nd WHEN clause), there's no need to see if the difference is greater than or equal to 60; it wouldn't be evaluating that clause if the 1st WHEN condition was TRUE.
This assumes that a.f_req_st_dt is a TIMESTAMP or DATE; either datatype can be compared with DATEs, such as SYSDATE-60, so there's no need to conevert them to strings, and then convert them back into DATEs.
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
Simplify the problem as much as possible. Show only the parts that you don't already know how to do.
Explain, using specific examples, how you get those results from that data.
Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
See the forum FAQ {message:id=9360002}
Never write, let alone post, unformatted code. Indent the code to show the exent and structure of clauses (SELECT, FROM, etc.), and complex expressions (such as CASE). The forum FAQ explains how to use \ tags when posting formatted text on this site. -
Missing expression Error using pivot function
Hi,
When i am running the query:
The query needs to display name and total:
{select *}
{ from (select name,nvl(sal,0) tot from tablea }
{ GROUP BY name,nvl(sal,0) }
{ pivot(SUM(tot) for name in (select ltrim(sys_connect_by_path(''''||name||'''', ','), ',') str}
{from ( select row_number() over(order by name) rn}
{ , name}
{ from tablea}
{where connect_by_isleaf=1}
{start with rn=1}
{connect by rn=prior rn+1);}
When running the above query its giving error:
ORA-00936: missing expression at line select ltrim(sys_connect_by_path
Any help will be needful for meIf you use pivot, you have to hardcode all your values in the FOR IN clause.
SQL> select *
2 from (select ename,nvl(sal,0) tot from emp
3 GROUP BY ename,nvl(sal,0)
4 )
5 pivot(SUM(tot) for ename in ( 'SCOTT' ,'KING') )
6 ;
'SCOTT' 'KING'
3000 5000You can't substitute the literal list of values (in my example ('SCOTT','KING') with a subquery producing similar result.
Only with pivot xml you can put there a subquery, in that case, the result however doesn't have to be in form of comma separated values (like you try to achieve with sys_connect_by_path)
SQL> select *
2 from (select ename,nvl(sal,0) tot from emp
3 GROUP BY ename,nvl(sal,0)
4 )
5 pivot xml (SUM(tot) for ename in ( select ename from emp where ename like 'S%' ) )
6 ;
ENAME_XML
<PivotSet><item><column name = "ENAME">SCOTT</column><column name = "SUM(TOT)">3000</column></item><
item><column name = "ENAME">SMITH</column><column name = "SUM(TOT)">800</column></item></PivotSet>Best regards
Maxim -
IDOC- JDBC --- ORA-00936: missing expression - Error
Hi all,
I am working on a IDOC-> JDBC scenario.
it works fine in development but in quality i amgetting the following message.
Message processing failed. Cause: com.sap.aii.af.ra.ms.api.RecoverableException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'T_SAP_COST' (structure 'Statement2'): java.sql.SQLException: ORA-00936: missing expression
there is no issue with mapping and i compared and everything is exactly the same as development.
Has someone come accross a similar issue.
Regards,
Tarun BahalThis is not an error with respect to XI. There is some problem with the SQL query generated after the mapping. Generally ORA____ kind of errors are comman in JDBC Senario and even Oracle maintains something like our SAP Note for each ORA errors. I am not sure about the URL for searching this error. You can check in this URL too, [ORA-00936 |http://ora-00936.ora-code.com/] http://ora-00936.ora-code.com/
Since you are saying that it works fine in developement, you can check with the data. Whether it is generating the SQL Statement properly or not. Also confirm whether you have sufficient data in the quality systems to generate the SQL Statement properly.
Edited by: Prasad Ulagappan on Oct 16, 2008 11:34 AM -
Pivot function and Missing expression error
select * from (
select T.PAT_MRN_ID, T.ABBREVIATION,CONCEPT_VALUE from TBL_WORKLFOw T
pivot
max(concept_value)
for ABBREVIATION in (select ABBREVIATION from TBL_WORKLFOW )
this query is throwing "missing expression"..error.
Can some one help figuring out the problem.Hi, Parth,
Parth Divekar wrote:
So your suggestion is to have it in a procedure ...form a dynamic sql using values from query and then execute the sql..That's one thing you can do.
You might also look into string aggregation, where you have one gargantuan column containing all the pivoted data from all the abbreviatons, no matter how many there are. That big column can be formatted so that it looks like several distinct columns.
Assuming dynamic SQL is the best answer, I find it easier to do in SQL*Plus, using files or substitution variables, as shown below. That's just my preference; you may like PL/SQL better.
How to Pivot a Table with a Dynamic Number of Columns
This works in any version of Oracle
The "SELECT ... PIVOT" feature introduced in Oracle 11
is much better for producing XML output.
Say you want to make a cross-tab output of
the scott.emp table.
Each row will represent a department.
There will be a separate column for each job.
Each cell will contain the number of employees in
a specific department having a specific job.
The exact same solution must work with any number
of departments and columns.
(Within reason: there's no guarantee this will work if you
want 2000 columns.)
Case 0 "Basic Pivot" shows how you might hard-code three
job types, which is exactly what you DON'T want to do.
Case 1 "Dynamic Pivot" shows how get the right results
dynamically, using SQL*Plus.
(This can be easily adapted to PL/SQL or other tools.)
PROMPT ========== 0. Basic Pivot ==========
SELECT deptno
, COUNT (CASE WHEN job = 'ANALYST' THEN 1 END) AS analyst_cnt
, COUNT (CASE WHEN job = 'CLERK' THEN 1 END) AS clerk_cnt
, COUNT (CASE WHEN job = 'SALESMAN' THEN 1 END) AS salesman_cnt
FROM scott.emp
WHERE job IN ('ANALYST', 'CLERK', 'SALESMAN')
GROUP BY deptno
ORDER BY deptno
PROMPT ========== 1. Dynamic Pivot using Script ==========
-- ***** Start of dynamic_pivot.sql *****
-- Suppress SQL*Plus features that interfere with raw output
SET FEEDBACK OFF
SET PAGESIZE 0
SPOOL p:\sql\cookbook\dynamic_pivot_subscript.sql
SELECT DISTINCT
', COUNT (CASE WHEN job = '''
|| job
|| ''' ' AS txt1
, 'THEN 1 END) AS '
|| job
|| '_CNT' AS txt2
FROM scott.emp
ORDER BY txt1;
SPOOL OFF
-- Restore SQL*Plus features suppressed earlier
SET FEEDBACK ON
SET PAGESIZE 50
SPOOL p:\sql\cookbook\dynamic_pivot.lst
SELECT deptno
@@dynamic_pivot_subscript
FROM scott.emp
GROUP BY deptno
ORDER BY deptno
SPOOL OFF
-- ***** End of dynamic_pivot.sql *****
EXPLANATION:
The basic pivot assumes you know the number of distinct jobs,
and the name of each one. If you do, then writing a pivot query
is simply a matter of writing the correct number of ", COUNT ... AS ..."\
lines, with the name entered in two places on each one. That is easily
done by a preliminary query, which uses SPOOL to write a sub-script
(called dynamic_pivot_subscript.sql in this example).
The main script invokes this sub-script at the proper point.
In practice, .SQL scripts usually contain one or more complete
statements, but there's nothing that says they have to.
This one contains just a fragment from the middle of a SELECT statement.
Before creating the sub-script, turn off SQL*Plus features that are
designed to help humans read the output (such as headings and
feedback messages like "7 rows selected.", since we do not want these
to appear in the sub-script.
Turn these features on again before running the main query.
PROMPT ========== 2. Dynamic Pivot using Substitution Variable ==========
-- ***** Preliminary Query: *****
COLUMN sql_txt_col NEW_VALUE sql_txt
WITH all_jobs AS
SELECT DISTINCT
job
, DENSE_RANK () OVER (ORDER BY job) AS r_num
FROM scott.emp
SELECT SYS_CONNECT_BY_PATH ( job || ''' THEN 1 END) AS '
|| job
|| '_CNT'
|| CHR (10) -- Newline, for legibility only
, ', COUNT (CASE WHEN job = ''' -- Delimiter, goes before each entry
) AS sql_txt_col
FROM all_jobs
WHERE CONNECT_BY_ISLEAF = 1
START WITH r_num = 1
CONNECT BY r_num = PRIOR r_num + 1
-- ***** Main Query *****
SELECT deptno
&sql_txt -- Ends with newline, so occupy that line
FROM scott.emp
GROUP BY deptno
ORDER BY deptno
EXPLANATION:
Using a substitution variable is very similar to using a script.
The main difference is that the output of the preliminary query has to
go into one row. This is done with SYS_CONNECT_BY_PATH, and getting
that requires that the jobs be numbered with consecutive integers, 1, 2, 3, ...
which we get from DENSE_RANK.
The NEWLINE character was added just to make the output line easier
to read during debugging.
*/ -
JDBC receiver - "ORA-00936:missing expression" error at sync.select command
Hi again,
questions, questions....
This is my select on the JDBC rec.connection:
I think this is a select with an AND (two criteria).
How does it look for an OR ?
At the moment we have another error:
Error when executing statement for table/stored proc. 'IRIS.T_ST_MAINDRIVER' (structure 'STATEMENT'): java.sql.SQLException: ORA-00936: missing expression
Hello experts,
what is this? I don´t think that a select calls a stored procedure which is the only result for threads when searching in this forum!
regards
DirkHi,
Are you trying to execute a Stored Procedure?
You can't get the result from an Oracle SP with JDBC. The problem is about the cursor return from SP, that couldn't bre understood by JDBC adapter.
You can, make a .NET wrapper to it. Make a .NET web service that gets the parameters from XI and runs the SP with them, get the oracle cursor return, transform it into a XML message and return it to the XI SOAP adapter. I've tryied and it works fine - and as I could see is the only way to perform calls to Oracle SPs with cursor return in XI.
hope this helps!
roberti
Message was edited by:
Waldemar Roberti -
Command missing expression error
Below is the command that I'm trying to modify and I'm currently getting an error. The lines in bold is what I added to the command.
SELECT DISTINCT OR_LOG.LOG_ID,OR_LOG.LOC_ID,PATIENT.PAT_NAME,V_MRN.MRN,PATIENT.PAT_ID
,TO_CHAR(OR_LOG.SURGERY_DATE,'MM/DD/YYYY') AS SURGERY_DATE,ROOM.PROV_NAME AS ROOM_NAME
,DIABETES.CODE,DIABETES.PARENT_NAME,DIABETES.DX_NAME
FROM EPICADM.OR_LOG OR_LOG INNER JOIN EPICADM.PATIENT PATIENT ON OR_LOG.PAT_ID=PATIENT.PAT_ID
INNER JOIN EPICADM.PAT_OR_ADM_LINK ADM_LINK ON OR_LOG.LOG_ID=ADM_LINK.OR_CASELOG_ID
INNER JOIN EPICADM.PAT_ENC_HSP ENC_HSP ON ADM_LK.OR_LINK_CSN=ENC_HSP.PAT_ENC_CSN_ID
INNER JOIN EPICADM.V_FV_MRN V_MRN ON OR_LOG.PAT_ID=V_MRN.PAT_ID
INNER JOIN EPICADM.CLARITY_LOC CLARITY_LOC ON OR_LOG.LOC_ID=CLARITY_LOC.LOC_ID
LEFT OUTER JOIN EPICADM.CLARITY_SER room ON OR_LOG.ROOM_ID = ROOM.PROV_ID
INNER JOIN
SELECT DISTINCT PAT_ID,REF_BILL_CODE,PARENT_NAME,DX_NAME
FROM
SELECT PROBLEM_LIST.PAT_ID,DIAB.REF_BILL_CODE,DIAB.DX_NAME,DIAB.PARENT_NAME
FROM PROBLEM_LIST INNER JOIN
SELECT EDG.DX_ID,EDG.DX_NAME,EDG.REF_BILL_CODE,EDG_PAR.DX_NAME AS PARENT_NAME,EDG_PAR.PAT_FRIENDLY_TEXT
FROM CLARITY_EDG EDG INNER JOIN CLARITY_EDG EDG_PAR ON EDG.PARENT_DX_ID=EDG_PAR.DX_ID
SELECT EDG_CURRENT_ICD9.CODE,CLARITY_EDG.DX_NAME
FROM EDG_CURRENT_ICD9 ON CLARITY_EDG .DX_ID=EDG_CURRENT_ICD9.DX_ID
WHERE (EDG_CURRENT_ICD9.CODE BETWEEN '250' and '250.99' OR EDG_CURRENT_ICD9.CODE BETWEEN '305' AND '305.99')
) DIAB ON PROBLEM_LIST.DX_ID=DIAB.DX_ID
UNION ALL
SELECT MEDICAL_HX.PAT_ID,DIAB2.REF_BILL_CODE,DIAB2.DX_NAME,DIAB2.PARENT_NAME
FROM MEDICAL_HX INNER JOIN
SELECT EDG.DX_ID,EDG.DX_NAME,EDG.REF_BILL_CODE,EDG_PAR.DX_NAME AS PARENT_NAME,EDG_PAR.PAT_FRIENDLY_TEXT
FROM CLARITY_EDG EDG INNER JOIN CLARITY_EDG EDG_PAR ON EDG.PARENT_DX_ID=EDG_PAR.DX_ID
SELECT EDG_CURRENT_ICD9.CODE,CLARITY_EDG.DX_NAME
FROM EDG_CURRENT_ICD9 ON CLARITY_EDG .DX_ID=EDG_CURRENT_ICD9.DX_ID
WHERE (EDG_CURRENT_ICD9.CODE BETWEEN '250' and '250.99' OR EDG_CURRENT_ICD9.CODE BETWEEN '305' AND '305.99')
)DIAB2 ON MEDICAL_HX.DX_ID=DIAB2.DX_ID
) CMB
) DIABETES ON OR_LOG.PAT_ID=DIABETES.PAT_ID
WHERE (PATIENT.TEST_PATIENT_YN <> 'Y'
OR PATIENT.TEST_PATIENT_YN IS NULL)
and OR_LOG.SURGERY_DATE BETWEEN epicadm.report_run_options('{?Report Run Options}','s',{?Start Date}) AND epicadm.report_run_options('{?Report Run Options}','e',{?End Date})
AND OR_LOG.PROC_NOT_PERF_C IS NULLNow I'm getting a missing righ parenthesis error.
SELECT DISTINCT OR_LOG.LOG_ID,OR_LOG.LOC_ID,PATIENT.PAT_NAME,V_MRN.MRN,PATIENT.PAT_ID
,TO_CHAR(OR_LOG.SURGERY_DATE,'MM/DD/YYYY') AS SURGERY_DATE,ROOM.PROV_NAME AS ROOM_NAME
,DIABETES.REF_BILL_CODE,DIABETES.PARENT_NAME,DIABETES.DX_NAME
FROM EPICADM.OR_LOG OR_LOG INNER JOIN EPICADM.PATIENT PATIENT ON OR_LOG.PAT_ID=PATIENT.PAT_ID
INNER JOIN EPICADM.PAT_OR_ADM_LINK ADM_LINK ON OR_LOG.LOG_ID=ADM_LINK.OR_CASELOG_ID
INNER JOIN EPICADM.PAT_ENC_HSP ENC_HSP ON ADM_LINK.OR_LINK_CSN=ENC_HSP.PAT_ENC_CSN_ID
INNER JOIN EPICADM.V_FV_MRN V_MRN ON OR_LOG.PAT_ID=V_MRN.PAT_ID
INNER JOIN EPICADM.CLARITY_LOC CLARITY_LOC ON OR_LOG.LOC_ID=CLARITY_LOC.LOC_ID
LEFT OUTER JOIN EPICADM.CLARITY_SER room ON OR_LOG.ROOM_ID = ROOM.PROV_ID
INNER JOIN
SELECT DISTINCT PAT_ID,REF_BILL_CODE,PARENT_NAME,DX_NAME
FROM
SELECT PROBLEM_LIST.PAT_ID,DIAB.REF_BILL_CODE,DIAB.DX_NAME,DIAB.PARENT_NAME
FROM PROBLEM_LIST INNER JOIN
SELECT EDG.DX_ID,EDG.DX_NAME,EDG.REF_BILL_CODE,EDG_PAR.DX_NAME AS PARENT_NAME,EDG_PAR.PAT_FRIENDLY_TEXT
FROM CLARITY_EDG EDG INNER JOIN CLARITY_EDG EDG_PAR ON EDG.PARENT_DX_ID=EDG_PAR.DX_ID
INNER JOIN
SELECT EDG_CURRENT_ICD9.CODE, CLARITY_EDG.DX_NAME
FROM EDG_CURRENT_ICD9 ON CLARITY_EDG .DX_ID=EDG_CURRENT_ICD9.DX_ID
WHERE (EDG_CURRENT_ICD9.CODE BETWEEN '250' and '250.99' OR EDG.REF_BILL_CODE BETWEEN '305' AND '305.99')
) DIAB ON PROBLEM_LIST.DX_ID=DIAB.DX_ID
UNION ALL
SELECT MEDICAL_HX.PAT_ID,DIAB2.REF_BILL_CODE,DIAB2.DX_NAME,DIAB2.PARENT_NAME
FROM MEDICAL_HX INNER JOIN
SELECT EDG.DX_ID,EDG.DX_NAME,EDG.REF_BILL_CODE,EDG_PAR.DX_NAME AS PARENT_NAME,EDG_PAR.PAT_FRIENDLY_TEXT
FROM CLARITY_EDG EDG INNER JOIN CLARITY_EDG EDG_PAR ON EDG.PARENT_DX_ID=EDG_PAR.DX_ID
SELECT EDG_CURRENT_ICD9.CODE, CLARITY_EDG.DX_NAME
FROM EDG_CURRENT_ICD9 ON CLARITY_EDG .DX_ID=EDG_CURRENT_ICD9.DX_ID
WHERE (EDG_CURRENT_ICD9.CODE BETWEEN '250' and '250.99' OR EDG.REF_BILL_CODE BETWEEN '305' AND '305.99')
) DIAB2 ON MEDICAL_HX.DX_ID=DIAB2.DX_ID
) CMB
) DIABETES ON OR_LOG.PAT_ID=DIABETES.PAT_ID
WHERE (PATIENT.TEST_PATIENT_YN <> 'Y'
OR PATIENT.TEST_PATIENT_YN IS NULL)
and OR_LOG.SURGERY_DATE BETWEEN epicadm.report_run_options('{?Report Run Options}','s',{?Start Date}) AND epicadm.report_run_options('{?Report Run Options}','e',{?End Date})
AND OR_LOG.PROC_NOT_PERF_C IS NULL -
Missing expression error...
Trying to do this in a function, that takes table_name, col_name, col_value
and returns 0 or 1
1- record exists
0- record does not exists - error
EXECUTE IMMEDIATE
' SELECT COUNT(*) INTO nExists
FROM ' || table_name ||
' WHERE ' || col_name || ' = ' || col_value ;
I need this in a function as this validation is required from many places.
Can I do something like this? If not any other better ways of achieving this...
ThanksIn a Procedure or Function u can use
Select <colum> into <variable only when
the select statement returns one record other
wise WHEN TOO_MANY_ROWS exception will be triggered.
Select statement with more then one record require cursor.
If u are very sure that select statment in going to return one row then
its better use select statement rather the cursor.
Hope this is clear. -
Hi All,
I had created a IR report based on a table and it was working with no issues. But after few days, when I try searching using the IR search bar it shows "ORA-20001: get_dbms_sql_cursor error ORA-00936: missing expression" error message. I don't see any debug messages or errors in the debug window. The Finder drop down is empty too, there are no columns displayed to filter.
When I recreate the IR report(new page) based on the same table, It works fine and there are no issues with the search. But the old IR report search doesnt work. I have not modified the any thing in the old report after initial creation. Report uses Primary key based on a sequence.
What might have caused this issue?
Is there a way to intercept the search query from IR report?
Apex version - 4.2.3.00.08.
Any help on this appreciated.
Thanks,
JaganHi MK, as I had mentioned in my post, I don't see any logs in the debug window, query tab.
Can you please guide me how to check the query logs on search?
Thanks,
Jagan -
Migrating from Sql server get SQL Error: ORA-00936: missing expression
All,
I'm migrating from Sql Server to oracle 10g and I'm getting a
"SQL Error: ORA-00936: missing expression" error
when the following create table statement is executed. It appears 10g does not like the CREATE DEFAULT xxxx as xxx syntax. Any ideas??
CREATE TABLE EnvCapitalOtherCostAtom (
EnvID CHAR(36) NOT NULL,
CapitalID CHAR(36) NOT NULL,
Seq FLOAT DEFAULT
CREATE DEFAULT D_Set_To_Zero
AS 0
NOT NULL,
AtomID CHAR(36) DEFAULT
CREATE DEFAULT D_NewGUID
AS newid
NOT NULL,
AtomName VARCHAR2(100) NOT NULL,
AtomName_dqa NUMBER(5,0) DEFAULT
CREATE DEFAULT D_DQA_Dflt
AS 10
NOT NULL,
CreatedOnTimeStamp TIMESTAMP(6) NOT NULL,
LastEditedOnTimeStamp TIMESTAMP(6) NOT NULL,
TFDubh_dqa NUMBER(5,0),
record_flags NUMBER(5,0) DEFAULT
CREATE DEFAULT D_Record_Flags
AS 0
NOT NULL,
record_dqa NUMBER(5,0) DEFAULT
CREATE DEFAULT D_Record_DQA
AS 30
NOT NULL
);Hi Chris,
not sure SQL Server accepts the syntax you provided either. Even more I have checked MSDN(http://msdn2.microsoft.com/en-us/library/ms173565.aspx) and they recommend:
Avoid using CREATE DEFAULT in new development work, and plan to modify applications that currently use it. Instead, use default definitions created using the DEFAULT keyword of ALTER TABLE or CREATE TABLE. CREATE DEFAULT will be removed in a future version of Microsoft SQL Server.
In Oracle you should do the same either use DEFAULT in CREATE TABLE statement or in ALTER TABLE, have a look at http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14251/adfns_constraints.htm#sthref626 for more details.
The proper Oracle syntax for your DDL should be something like:
CREATE TABLE EnvCapitalOtherCostAtom (
EnvID CHAR(36) NOT NULL,
CapitalID CHAR(36) NOT NULL,
Seq FLOAT DEFAULT 0 NOT NULL,
AtomID CHAR(36) DEFAULT SYS_GUID() NOT NULL,
AtomName VARCHAR2(100) NOT NULL,
AtomName_dqa NUMBER(5,0) DEFAULT 10 NOT NULL,
CreatedOnTimeStamp TIMESTAMP(6) NOT NULL,
LastEditedOnTimeStamp TIMESTAMP(6) NOT NULL,
TFDubh_dqa NUMBER(5,0),
record_flags NUMBER(5,0) DEFAULT 0 NOT NULL,
record_dqa NUMBER(5,0) DEFAULT 30 NOT NULL
); -
ORA-00936: Missing Expression when using a claculation as a condition item
Hi
I created a calculation below to create a subtotal on each row of a group of selected items.
SUM(Invoice Amount)OVER(PARTITION BY Supplier Num ORDER BY Payment Currency Code)
This worked fine - but then I wanted to create a condition based on this calculation and when I used the calculation as a condition item and reran the report I received the 'ORA-00936: Missing Expression' error. So not too sure why it is fine as a calculation but not as part of a condition.
We use Discoverer version 4.1
Am I missing something or is this a bug?
Any help would be very appreciated
Thanks
MarcusThanks for your reply, Rod
We are using the 9.2.0.5 version of the database
I am not a SQL expert, by any means, but below is the line that refers to the condition in the sql inspector
WHERE ( ( E_152 )/2 > 50)
presuambly that means E_152 is the calculation, I think this may be refering to this at the beginning of the report:
SELECT DISTINCT E316344 as E316344,E316372 as E316372,E316411 as E316411,E316425 as E316425,E316496 as E316496,E316497 as E316497,E316498 as E316498,E316510 as E316510,E316511 as E316511,E316512 as E316512,E316515 as E316515,E316517 as E316517,E316519 as E316519,E316520 as E316520,E_24 as E_24,E_21 as E_21,E_18 as E_18,E_16 as E_16,E_13 as E_13,E_11 as E_11,E316501 as E316501 FROM ( SELECT E_152 as E_152,DISTINCT E316344 as E316344,E316372 as E316372,E316411 as E316411,E316425 as E316425,E316496 as E316496,E316497 as E316497,E316498 as E316498,E316510 as E316510,E316511 as E316511,E316512 as E316512,E316515 as E316515,E316517 as E316517,E316519 as E316519,E316520 as E316520,E_24 as E_24,E_21 as E_21,E_18 as E_18,E_16 as E_16,E_13 as E_13,E_11 as E_11,E316501 as E316501 FROM ( SELECT DISTINCT i316344 as E316344,i316372 as E316372,i316411 as E316411,i316425 as E316425,i316496 as E316496,i316497 as E316497,i316498 as E316498,i316510 as E316510,i316511 as E316511,i316512 as E316512,i316515 as E316515,i316517 as E316517,i316519 as E316519,i316520 as E316520,SUM(i316501) OVER(PARTITION BY i316345 ORDER BY i316520 )/2 as E_24,( i316501-( NVL(i316502,0) ) )*( NVL(i316522,1) ) as E_21,i316501-( NVL(i316502,0) ) as E_18,NVL(i316502,0) as E_16,i316501*( NVL(i316522,1) ) as E_13,NVL(i316522,1) as E_11,i316501 as E316501,SUM(i316501) OVER(PARTITION BY i316345 ORDER BY i316520 ) as E_152
Apologies if this info is not that helpful
Would it have anything to do with the fact that the row calculation is based on several rows (i.e. a subtotal) and if a single row is excluded it would change the value of the other rows within that subtotal group. Maybe it causes some sort of circular issue?
Anyway, thanks again for your help - hopefully we can resolve it
Marcus
Maybe you are looking for
-
How do I know what version of Java I have?
I'm getting error messages in my Cox email "unable to initialize applet", "Unable to get HTML message", etc. I can't reply or forward any messages. I don't know if this is a Cox problem or Apple problem.
-
Business Rules and Business Intelligence in Java CAPS 6
Dear All, I have two doubts. 1. Is there any way to add a Business Rule component and write Business rules in Java CAPS 6? As you may know, this is possible through eInsight in JCAPS 5.1.2. Is this feature readily available in Java CAPS 6? If yes, ca
-
System copy - NW2004s BI - ABAP & JAVA
Hi We plan to create a new NW2004s (SRII) BI ABAP & JAVA system through a system copy. As this is java & abap it would seem using the sapinst method using the install CD would be best. I am looking for documentation for this method and I wondered
-
Can I Change My name in the Profile
Hi All, Don't mine any one that I Asked this Q here How To Change My Name in the SDN Profile ??? I Given My Pet name At the Time of Registration in SDN. So I Want to Change My Display Name As Wel As The name in the Database I Tried Like this GotoMy
-
hi, I have Mack G4 powerbook with Mac os 10 .4.11, can any badey help me how to install software on my laptop though i tried a lot but failed to install.