SQL & PL/SQL :: Dynamic Statement In Database Package - Missing Expression

Feb 29, 2012

I have the following statement dynamic sql statement in a database package.

begin
EXECUTE IMMEDIATE 'SELECT REPLACE(SUBSTR('||V_WHERE_CLAUSE||',1,3, ''AND'', NULL) INTO V_WHERE_FILTER FROM DUAL';
EXCEPTION
NULL;
end;

When executed it gives following error.

ORA-20000: ORA-20000: ORA-00936: missing expression
### TRACE ### ORA-06512: at "NDSS.DUP_SRCH_PKG_MOD", line 931
### END TRACE ###
### TRACE ### ORA-06512: at "NDSS.DUP_SRCH_PKG_MOD", line 935
ORA-06512: at "NDSS.DUP_SRCH_PKG_MOD", line 164
### END TRACE ###
ORA-06512: at "NDSS.DUP_SRCH_PKG_MOD", line 184
ORA-06512: at line 9

View 4 Replies


ADVERTISEMENT

PL/SQL :: Using NVL Function In Dynamic SQL / ORA-00936 / Missing Expression

May 8, 2013

I have created a procedure using the Dynamic SqL and while using the NVL() getting the following error . ORA-00936: missing expression.

The query I have written as

SQL_Txt:=' INSERT INTO VF.tblCData (A, B, C, D, E, F,G,H,I,J)
SELECT '||l_A||',
'||l_B||',
'||l_C||',
'||l_D||',
NULL ,
'||L_F||',

[code]....

For Param1 I have data for one execution and Param2 and Param3 is null for that execution.While executing the same I am getting below

INSERT INTO VF.tblCData (A, B, C, D, E, F,G,H,I,J)
SELECT 25,
1,
7,
6,
NULL ,
5,

[code]....

and error ORA-00936: missing expression is popping up for Param2 and Param3 NVL(,'')

View 10 Replies View Related

ORA-00936 :: Missing Expression?

Jul 9, 2010

im trying to take a query that pulls all the info in the current tables, and narrow it down to one day plus current. here is the error i am getting.

(SELECT OH.ORD_CNTRL_NO, OH.ORD_NO, OH.ASSGN_SHIP_DATE, oh.account_no, sum(OL.ORD_QTY) AS ORD_QTY
*
ERROR at line 5:
ORA-00936: missing expression

old query:

 select a.assign_no, a.assign_type, a.act_end, X.ord_no, x.account_no, 
X.ASSGN_SHIP_DATE, X.ORD_QTY, td.from_loc, sum(td.act_qty) AS ACTQTY, sum(td.exp_qty) AS EXPQTY 
from clsd_assign a, clsd_task t, clsd_task_detail td,  sku s,
(SELECT OH.ORD_CNTRL_NO, OH.ORD_NO, OH.ASSGN_SHIP_DATE,  oh.account_no, sum(OL.ORD_QTY) AS ORD_QTY

[code]...

new query

 select a.assign_no, a.assign_type, TRUNC(A.ACT_END), to_char(a.act_end), X.ord_no, x.account_no, 
X.ASSGN_SHIP_DATE, X.ORD_QTY, td.from_loc, sum(td.act_qty) AS ACTQTY, sum(td.exp_qty) AS EXPQTY 
from clsd_assign a, clsd_task t, clsd_task_detail td,  sku s
where  a.act_end  between to_char(sysdate -1, 'dd-mon-yyyy') and to_char(sysdate, 'dd-mon-yyyy')

[code]...

View 2 Replies View Related

PL/SQL :: Ora-00936 Missing Expression?

Aug 22, 2012

i am posting create and insert statements for a problem i am facing

create table tgh(NAME VARCHAR(20),LANG VARCHAR(20))

insert into tgh values('AC','ORIYA')
insert into tgh values('DF','BENGALI')
insert into tgh values('ik','english')

the below statements are for table copu

create table copu(CNAME VARCHAR(20),CLANG VARCHAR(20))

insert into copu values('ACdf','oriya')
insert into copu values('deg','ptot')

when i do  another insert as shown below

insert into copu (cname,clang) values  where
copu.cname not exists in( select  tgh.name,tgh.lang from tgh where upper(tgh.name)=upper(copu.cname))

i get ora-00936 missing expression

View 12 Replies View Related

SQL & PL/SQL :: Subtract Dates - Missing Expression

Nov 13, 2012

New to using Oracle and SQL Developer. I am trying to subtract a maximum date from today and adding back 1 to get a field named daysSinceLastActivity....

Syntax I am trying is (date()-max(activity_date))+1 as daysSinceLastActivity

I keep getting a error message of missing expression. After googling, I am not finding anything. This should be a simple calculation.

View 3 Replies View Related

SQL & PL/SQL :: Getting ORA-00936 / Expression Missing Error?

Mar 25, 2013

I ran into a problem recently which has to do with the following query:

SELECT '' || ROUND(GEOGR_LAENGE,5) || ',' || ROUND(GEOGR_BREITE,5) || '," [BUE] ' || BAUFORM_GRUPPE || '"', KM
AS TEXT
FROM MYTABLEA mmtable
WHERE (mmtable.GEOGR_LAENGE IS NOT NULL
AND mmtable.GEOGR_BREITE IS NOT NULL
AND mmtable.STRECKE_NR IN
(

[code].....

The problem is, that Oracle alerts a missing expression at line 4, and highlights the "IS NOT NULL". Personally I don't see that anything is wrong with this line. I think the problems source is somewhere else but I cannot find it.

I'll give you a little bit of background to the script:

What I am trying to achieve is to request the values in the first line with the following conditions:

- mmtable.GEOGR_LAENGE, GEOGR_BREITE must not be empty
- rbtable.STRECKE_NR for the requested line (which is similar to mmtable.STRECKE_NR) must have "MITTE" as a value for NL_NAME
- mmtable.KM => rbtable.VON_KM
- mmtable.KM <= rbtable.BIS_KM

so that only those lines will be returned.

View 8 Replies View Related

Getting ORA-00936 / Missing Expression Error?

Dec 4, 2012

I'm working on Oracle SQL Developer: ODMiner. I keep getting a syntax error with the following code,

CREATE TABLE FINAL_WEBLOG AS
select SESSION_DT, C_IP, CS_USER_AGENT,
LISTAGG(WEB_LINK, ' ')
WITHIN GROUP (ORDER BY C_IP, CS_USER_AGENT) "WEB_LINKS",
FROM WEBLOG_VIEWS
GROUP BY C_IP, CS_USER_AGENT, SESSION_DT
ORDER BY SESSION_DT

I understand if it's the semicolon that is missing after "FROM WEBLOG_VIEWS", but I'm not sure on how I can rephrase it.

The error I got was,

Error at Command Line:5 Column:2
Error report:
SQL Error: ORA-00936: missing expression
00936. 00000 - "missing expression"
*Cause:
*Action:

View 1 Replies View Related

PL/SQL :: Missing Expression Error during EXECUTE IMMEDIATE?

Jun 6, 2012

CREATE TABLE  "T_LIDER"
   (     "LIDER" NUMBER(5,0),
     "TRR" NUMBER(8,0),
                "SUG_I"  NUMBER(2,0),
      "LIDER_TAY" NUMBER(2),
   
[code]...

i've tried to simplify the problem and i saw that the function returns this error what seems to be the problem ?

View 11 Replies View Related

SQL & PL/SQL :: ORA-00936 - Missing Expression Error While Running

Mar 28, 2013

I am getting the ORA-00936: missing expression error while running the below stated query. Problem is that it is running and fetching the data successfully for the first 5 runs. But from the 6th run it is not fetching the data and throwing the ORA-00936: missing expression error. consider I am passing parameters to the query and for the first 5 values i pass its runnign fine. when i run the query for the 6th time or more with different parameter, its throwing the error. it does not seems to be the data issue because when i pass the 6th parameter for the first run on the next day, it is fetching data.

(SELECT ABC.POST_SMRY_CORR_I,NVL(ABC.CORR_TYPE_C,' ') AS CORR_TYPE_C,NVL(ABC.ENTR_DOC_I,' ') AS ENTR_DOC_I,
ABC.EST_LIQN_D, '' AS EVNT_TYPE_C, ABC.CORR_STAT_C
FROM POST_SMRY_CORR ABC,POST_ENTR_DISCP PSCWQ,ENTR_DOC ED
WHERE ABC.POST_SMRY_CORR_I = PSCWQ.POST_ENTR_DOC_I
and ED.ENTR_DOC_I = '123'AND ABC.ENTR_DOC_I=ED.ENTR_DOC_I
AND ED.ENTR_TYPE_C != 11
AND POST_ENTR_TYPE_C='PSC' AND DISCP_STAT_C !='CL' AND ABC.CORR_STAT_C !='CLS'
[code]....

View 5 Replies View Related

SQL & PL/SQL :: Oracle 10g Database - Building Dynamic Insert Statement?

Aug 23, 2012

i'm working in an Oracle 10g database on an IBM AIX server.

I have 3 tables (tables A, B and C).

Table A has columns -- product, rate and expiration date.

Table B has columns -- product, rate and deductible.

Table C has columns -- product, rider, gender, age and rate.

I also have a Master table which is used to store the data from Tables A, B and C via the insert statement.

I'm trying to create a dynamic SQL insert statement using a shell script to insert data from the columns in Tables A, B and C into my Master table. Master table does contains all columns from Tables A, B and C, although a column name could be spelled differently. For example, Master table contains a column named "deduct", while Table B has the same column spelled as "deductible".

I build the dynamic query using a for loop in my shell script (see below).

The problem is that i can't get the correct columns in the Master table in the dynamic SQL for the insert because depending on the table i'm selection from, the columns are different. So how do i get the correct columns in the SQL for the Master table?

Example Shell Script

--Archive_Rates.txt contains: Table A, Table B, Table C (but the next time my process runs, Archive_Rates might contain Table D, Table E and Table F -- each which have different column...but all columns are still in the Master table)

for tbl in `more Archive_Rates.txt`
do
echo 'BEGIN WORK; ' > rc1.sql
echo ' ' >> rc1.sql
echo 'insert into Master' >> rc1.sql
echo '(prod, rate, rate_exp) ' >> rc1.sql

[code].....

View 5 Replies View Related

JDeveloper, Java & XML :: Missing Expression And Then Group Function Not Allowed Error

Feb 23, 2011

I have 2 tables used in this problem: ODETAILS and ORDERS.

ODETAILS has the following columns: ONO, PNO, QTY, COST
ORDERS has the following columns: ONO, CNO, ENO, RECEIVED, SHIPPED, ORDER_COST

UPDATE ORDERS
SET ORDER_COST= 1 * ( select SUM(
SELECT COST
FROM ODETAILS
WHERE ORDERS.PNO=ODETAILS.PNO
)
);

In ODETAILS there can be more than 1 row for 1 order. So I'm trying to add all the COSTs in ODETAILS.

View 3 Replies View Related

SQL & PL/SQL :: To_char Function In Combination With Distinct Clause - ORA-00936 / Missing Expression

Mar 2, 2012

I have a very simple table with 2 columsn. As_of_date is one of the column. This column is "Date" data type.

When I use distinct clause inside a to_char function it gives the following error:

ORA-00936: missing expression
00936. 00000 - "missing expression"

The Sql is

select to_char(distinct(as_of_date),'mm-dd-yyyy') from sales

I can't see any syntax error in the sql..but forsome reason, it doesn't work.

View 2 Replies View Related

SQL & PL/SQL :: Evaluate Dynamic Math Expression?

Jun 22, 2008

I have a user interface where the user can enter a formula using a set of parameters and operators. For eg , the user is given a list of parameters, say : Width, Height , Gauge. The list of operators include standard math functions : + - / * ^

He can select and create a formula like gauge * width. This is stored in a table. At a later time a job is scheduled to evaluate the formula based on parameters for width, gauge and height.

I can evaluate the expression by substituting each parameter.

I can do this using dynamic sql. However I'm not sure how to evaluate the ^ symbol. The equivalent of this is power function.

So if a user enters (height * 2) + (width^2) . How do i evaluate this. I am doing this in pl/sql.

View 6 Replies View Related

SQL & PL/SQL :: Missing UTL_SMTP Package Body?

Mar 5, 2012

I tried to create a UTL_SMTP package using '@?/rdbms/admin/utlmtp.sql' script but there are no package body for UTL_SMTP is created. There are only UTL_SMTP package is create.

View 4 Replies View Related

SQL & PL/SQL :: Execute The Expression In Select Statement

Feb 12, 2013

CREATE TABLE TEST1
(
OFFICE_PRODUCTS NUMBER,
OFFICE_ELECTRONICS NUMBER
)
Insert into TEST1 (OFFICE_PRODUCTS, OFFICE_ELECTRONICS) Values(1, 0);
COMMIT;

CREATE TABLE TEST2
(
EXPORT_FIELD_NAME VARCHAR2(100 BYTE),
EXPORT_COLUMN_EXPRESSION VARCHAR2(100 BYTE)
)
Insert into TEST2
(EXPORT_FIELD_NAME, EXPORT_COLUMN_EXPRESSION)
Values ('A1', 'least(OFFICE_PRODUCTS, OFFICE_ELECTRONICS)');
COMMIT;

I want to be execute the expression should run in select statement how to do? and tried as like below,it's not working.

select (select EXPORT_COLUMN_EXPRESSION from test2 where EXPORT_FIELD_NAME='A1') FROM TEST1;

View 15 Replies View Related

SQL & PL/SQL :: How To Get The Missing Records Using Only One Statement

Jan 1, 2011

Ten thousand (10000) records ,but in the TABLE that has a uniqure sequence of column named seq, find only 9 thousand (9000) records. I want to find out the missing records. The following is my approach, but it is not the best way

1.CREATE TABLE my_public_seq (seq number(10));

2.
DECLARE
vn_seq NUMBER(10);
BEGIN
FOR i IN 1..10000
LOOP
INSERT INTO my_public_seq VALUES(i);
END LOOP;
COMMIT;
END;

3. run sql
SELECT seq FROM my_public_seq
MINUS
SELECT seq FROM my_original_table_that_missing_some_records;

How to get the missing records using only one SQL statement.

View 1 Replies View Related

PL/SQL :: Find Out In Database Package Where Package Is Installed

May 28, 2013

I need to find out in DB Package where this Package is installed (in which schema). The problem is this DB Package can be installed in various schemas. This means that I can't use select user from dual or system environment SYS_CONTEXT('USERENV', 'OS_USER').

What I would need is something like $$PLSQL_UNIT

View 8 Replies View Related

Reports & Discoverer :: Case Statement Inside Oracle Query - Missing Right Parenthesis

Jun 13, 2013

Can I use CASE statement Inside a Oracle Report Query. I'm using Oracle Reports Builder 10g.

My Report Query looks like this,

select invh_code, invh_number, invh_date, invh_cm_code, im_description
from invoice_head, invoice_det, unit_of_measurement, item_master
where invd_invh_code = invh_code and im_code = invd_item_code
AND
(case :p_flag when 1 then (substr(invd_item_number,0,(length(invd_item_number)-4)) BETWEEN :P_V_ITM_FRM AND :P_V_ITM_TO)
else 1
end)
order by invh_number

:p_flag is a parameter that i pass from oracle form and based on that value (:p_flag=1) i need to include this specific condition
else omit that condition.

But the CASE statement is throwing Error

ORA-00907 :Missing Right Paranthesis
(case :p_flag when 1 then (substr(invd_item_number,0,(length(invd_item_number)-4))
==> BETWEEN :P_V_ITM_FRM AND :P_V_ITM_TO)

View 6 Replies View Related

Dynamic Alter Tablespace Statement To Add Datafiles

Jan 21, 2013

I need a PL/SQL stored procedure which will accept a datafile name as parameter and dynamically create and execute "alter tablespace" command to add this passed datafile dynamically.

View 6 Replies View Related

SQL & PL/SQL :: Difference Between Include Program Header Before CREATE OR REPLACE PACKAGE Statement

Mar 2, 2010

Is there any difference between include program header before CREATE OR REPLACE PACKAGE statement and program header after CREATE OR REPLACE PACKAGE statement

View 4 Replies View Related

Ora-00904 Error For NDS Dynamic Alter Table Statement

Nov 30, 2011

how to play around with NDS dynamic sql and I'm trying to add a column on the fly.Basically the procedure is trying to take a table name, column name, and eventually a data type and adds it to a table.

It works fine without the bind variable for the column name, accepting the table name on the fly.As soon as it tries to use the column name I get an ORA-00904 invalid identifier exception.

Here is the procedure I'm using

CODEcreate or replace
procedure test(tbl_name varchar2, col_name varchar2) IS
qry varchar2(500);
begin

[code]....

Here is how I'm executing it.

CODEexecute test(tbl_name => 'BB_SHOPPER', col_name => 'MEMEBER');

View 3 Replies View Related

PL/SQL :: PLS-00455 / Cursor CUR_1 Cannot Be Used In Dynamic SQL OPEN Statement

May 10, 2013

create or replace package cognos_pk as /* Creates Package Header*/
TYPE project_type IS record( /* A record declaration is used to */
c1 NUMBER /* provide a definition of a record */
); /* that can be used by other variables*/
TYPE project_type1 IS REF CURSOR  return project_type; /* Variable declaration */
procedure conosg_sp (result1  out project_type1); /* SP declaration */
end;

[code]....

View 2 Replies View Related

SQL & PL/SQL :: Convert Update Query To Dynamic To Be Executed From Execute Immediate Statement

Oct 25, 2010

I want to convert the below SQL to a dynamic sql to be executed from execute immediate statement.

UPDATE transaction SET loannum = lpad(loannum,12,'0')

View 15 Replies View Related

Forms :: Dynamic Variable In Place Of Username In Each Select Statement Throughout Application

Jul 25, 2010

I have a problem that i have hard coded the username.tablename in each select statement of all forms of my application. Now i want to use a dynamic variable in place of username in each select statement throughout the application. The example is:

select * from scott.emp
and i want to write it as:
select * from variable.emp

But at compilation of the form the compiler should know the above variable name.

I have tried to use following select statement but it does not work.

select user into :global.username from user_users

I think perhaps my problem would be solved with Dynamic SQL Statement but i have no experience by using this statement.

View 4 Replies View Related

SQL & PL/SQL :: Missing Values In Database?

Nov 22, 2012

i´ve got a table with colomns (time, value) ... for example:

time value
10:00 10
11:00 20
12:00 25
13:00 28
15:00 31
17:00 38

you can see, that the row 14:00 and 17:00 are missing. How i can create the missing values? The value should be the value from the last point. The result should be this:

time value
10:00 10
11:00 20
12:00 25
13:00 28
14:00 28
15:00 31
16:00 31
17:00 38

How can i do this ?

View 23 Replies View Related

SQL & PL/SQL :: Expression Must Have Same Datatype As Corresponding Expression

Dec 22, 2010

ved>create table test900 ( a number, b number);

Table created.

ved>insert into test900 values( 9,'');

1 row created.

ved>insert into test900 values( 10,null );

1 row created.

ved>select * from test900;

A B
---------- ----------
9
10
ved>select nvl(length(b),0) from test900;
[code]....

ERROR at line 1:
ORA-01790: expression must have same datatype as corresponding expression..Why the above sql ( case 2 ) gives error?

View 9 Replies View Related

SQL & PL/SQL :: Select Dynamic Column Names In Select Statement In Function?

Jul 4, 2010

i want to select dynamic column names in my select statement in my function.

View 4 Replies View Related

Enterprise Manager :: Database Control Missing Plugin?

Jul 25, 2013

I am using oracle 11g on OEL 5.8. Facing problem in database control, when i browse using database control it shows me missing plugin. I have install jre 6 but no luck.

View 1 Replies View Related

Application Express :: Database Monitor Module Missing In 4.2.2?

Jul 4, 2013

When login as a administrator, am unable to find the above in SQL Workshop / Utilities. it's not drop from 4.2.2 , very useful functions. 

View 2 Replies View Related

Data Guard :: Standby Database Temp Files Go Missing?

Jun 5, 2013

I performed a switchover test of my Exadata databases last night. Both databases are running 11.2.0.2 (BP7) on top of GI of the same version.I'm using Data Guard Broker to administer the Data Guard configuration.

I have, as you'd expect, the standby_file_management set to AUTO, so any file changes/additions/deletions that are made on Primary should be applied to Standby also.And they have been. Until last night.

When I had switched over to running Primary on the Standby site, I got this error message:

Tue Jun 04 22:27:12 2013
Errors in file /u01/app/oracle/diag/rdbms/exdw1pdg/exdw1pdg1/trace/exdw1pdg1_ora_26630.trc:
ORA-25153: Temporary Tablespace is Empty

I checked and my two temp tablespaces existed, but had no files in them. These files are 200Gb and 448Gb in size, so you'd think you'd notice them going missing. This wasn't by any means the first time we switched over (and, yes, I did create temp files for Standby when I built it and first switched over)

We've switched over to Standby multiple times and even ran a whole day's processing against it and haven't seen this. Ultimately, it wasn't a big deal, because I just created a tempfile for each of the tablespaces and off we went.Nothing in MOS seems to mention something like this. Basically, it looks like the switchover process decided to eat my tempfiles but keep my temp tablespace defintion. Odd.

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved