PL/SQL :: Insert Results To Fact Table - Missing Right Parenthesis

Nov 14, 2013

im trying to insert these results to my fact table (fact_apartments) with the following: 

INSERT INTO fact_apartments(avg_price, segmentid, projectid)  
SELECT (avg(price), segmentid, projectid)    
FROM projectdetails      
WHERE projectid = '1'; 

but it return with the missing right parenthesis.

View 11 Replies


ADVERTISEMENT

PL/SQL :: Missing Right Parenthesis

Feb 12, 2013

I am running the following query but getting an error

Select
     main.dietdate,
     main.dietCombinationId,
     main.diet_combination_name,
     main.DTYPE,
     Sum(main.TOTALVAL) as SCount,

[Code]....

ERROR at line Where Dem.diet_combination_id = DESS.diet_combination_id main , mas_diet_combination mmh ORA-00907: missing right parenthesis

finding where I am getting wrong

"WORST query formatting as the above query was written (by some developers) in MySQL and being migrated to oracle"

View 5 Replies View Related

ORA-00907 - Missing Right Parenthesis?

Oct 21, 2010

i'm trying to create table and im getting this error all the time.

CREATE TABLE Category (
Name CHAR(20) NOT NULL,
CategoryId INTEGER UNSIGNED NOT NULL,
RRO DOUBLE NULL,
LRO DOUBLE NULL,
IHRRO DOUBLE NULL,
PRIMARY KEY(Name, CategoryId)
);

View 2 Replies View Related

Query - Missing Right Parenthesis?

Sep 10, 2003

My query

SELECT node_nme, os_nme, os_vrsn_nme, CPU_QTY, mch_id_nme
FROM node_t
WHERE node_nme IN
(
SELECT DISTINCT upper(node_nme) as node_nme FROM node_t WHERE row_status_cde IN (1,4)

[code]...

Now, when I run this i get the missing parenthesis error, though I don't konw why.The subselect in the IN works fine and returns exactly what it should.

View 2 Replies View Related

ORA-00907 - Missing Right Parenthesis

Sep 21, 2010

I have been looking at this now for a good 2 hours. It seems like a simple error but I just cant see it. I must of counted the brackets 20 times. I have run this code in SQL developer using actual values and it works fine.

If your wondering about the esig class it just runs the sql with a few other SQL statements. I have changed the code below to a SELECT * statement just so see if it was actually that statement that was the problem. The select worked so it must be this.

Original
- oracle Code

$esig->setSQL("INSERT INTO document_ecopy
(DOCUMENT_ECOPY_ID
,DOCUMENT_UUID

[Code].....

View 2 Replies View Related

SQL & PL/SQL :: Ora-00907 - Missing Right Parenthesis?

Mar 28, 2010

I have following query. I checked manytime but I am unable to find the reason of error Ora-00907

SELECT Working_Days(sdate,edate),
Ddecode(Physical_files Between 1 And 500 And Working_Days(sdate,edate) Between 1 And 30,-1,
decode(Physical_files Between 501 And 3000 And Working_Days(sdate,edate) Between 1 And 180,-1,0)) col2
FROM table1 INNER JOIN table2
ON table1_Sno=table2_Sno

In this query, working_days is function that return working days.

View 5 Replies View Related

Missing Right Parenthesis Error?

Apr 2, 2008

Im running the following code and receiving 'error ORA-00907: missing right parenthesis' when I try and run the

to_char(((FAF_CALC_CCONTRIB (FA_ASSESSMENT.IDENTIFIER,'C'/7)*(TRUNC(TO_DATE(CPC_PROVISIONS.ACTUAL_END_DATE,'DD-MON-YY') - TO_DATE(CPC_PROVISIONS.ACTUAL_START_DATE,'DD-MON-YY')))),'FM9999990.00'),

If I remove this line then the SQL runs without problems. I think it's the first part FAF_CALC_CCONTRIB (FA_ASSESSMENT.IDENTIFIER,'C'thats causing the problems because I am using near identical code in another script which works perfectly.

View 2 Replies View Related

PL/SQL :: ORA-00907 - Missing Right PARENTHESIS?

May 1, 2013

CREATE TABLE titledds
(     Title_Id NUMBER(4) PRIMARY KEY
     TName VARCHAR2(20) NOT NULL UNIQUE
     Price NUMBER(5)
     Discount NUMBER(2)
     TextCat VARCHAR2(5)
);

wen i enter this im getting an error @ TName VARCHAR2(20) NOT NULL UNIQUE

ORA-00907: MISSING RIGHT PARENTHESIS

im using 11g 2nd release..

View 3 Replies View Related

Missing Right Parenthesis All In Line 2?

May 22, 2011

CREATE TABLE LOCATION(
Locid NUMBER (5) LOCATION_LOCID_PRIMARY KEY,
Bldg_Code VARCHAR2 (10) NOT NULL,
Room VARCHAR2 (6) NOT NULL,
Capacity NUMBER (5));
CREATE TABLE FALCULTY(

[code]...

View 6 Replies View Related

SQL & PL/SQL :: ORA-00907 / Missing Right Parenthesis

Sep 21, 2010

I am trying to execute the following query

SELECT inst_id, SID, serial#, module,username, machine, action, logon_time,status,event FROM gv$session
WHERE SID in
(
SELECT sid,id1,request FROM GV$LOCK
WHERE (id1, id2, type) IN
(SELECT id1, id2, type FROM GV$LOCK WHERE request>0) ORDER BY id1, request
)

And I received the following error message

ORA-00907: missing right parenthesis

But when I execute

SELECT inst_id, SID, serial#, module,username, machine, action, logon_time,status,event FROM gv$session

and

SELECT sid,id1,request FROM GV$LOCK
WHERE (id1, id2, type) IN
(SELECT id1, id2, type FROM GV$LOCK WHERE request>0) ORDER BY id1, request

separately. It works fine. Why is it erroring out when I include the query in WHERE clause. Rather than the work around, I would like to know the reason for the need of right paranthesis.

View 5 Replies View Related

ORA-00907 Missing Right Parenthesis

Aug 14, 2011

I am new to Pl/SQL, I have created the following statement but I am getting ORA-00907: missing right parenthesis 00907. 00000 - "missing right parenthesis"

SELECT P.PERSON_ID,
P.EMPLOYEE_NUMBER "Employee ID",
P.FIRST_NAME "FRSTNAME",
P.MIDDLE_NAMES "MIDLNAME",
P.LAST_NAME "LASTNAME",

[Code]....

View 3 Replies View Related

Missing Right Parenthesis Error On Line 7

Mar 10, 2012

I'm working on my database homework, and I came across an error that I cannot seem to fix. I'm getting a missing right parenthesis error on line 7, but I seem to have all my parenthesis, endless I'm overlooking one.

DROP TABLE RoomDM CASCADE CONSTRAINTS PURGE;
1 CREATE TABLE RoomDM (
2 rNo VARCHAR(4),
3 hNo NUMBER(3),
4 type CHAR(6) NOT NULL,
5 price NUMBER(3,2) NOT NULL,
6 CONSTRAINT RoomDM_PK PRIMARY KEY (rNo, hNo),
7 CONSTRAINT RoomDM_hNo_FK FOREGIN KEY (hNo)
8 REFERENCES HotelDM (hNo) ON DELETE CASCADE,
9 CONSTRAINT RoomDM_type_CK CHECK(type IN(single, Double, Family))
10 );

The error looks like this:

CONSTRAINT RoomDM_hNo_FK FOREGIN KEY (hNo)
* ERROR at line 7:
ORA-00907: missing right parenthesis

View 2 Replies View Related

Top / Bottom Query - ORA-00907 / Missing Right Parenthesis

Mar 13, 2007

I'm trying to create a Top / Bottom query from an example i already have but when i executed it, i got an error:

ORA-00907: missing right parenthesis

The coding i've got is:

SELECT customer_id, forename, surname, start_date_time, end_date_time, pos
FROM (
SELECT customer_id, forename, surname, start_date_time, end_date_time,
row_number() over (
partion by start_date_time
order by customer_id asc) pos
from customer, phone_call)
where pos = 1;

The error is on the partition line but i've closed all the open brackets,

View 2 Replies View Related

Server Utilities :: ORA-00907 / Missing Right Parenthesis

Apr 24, 2012

expdp test/test directory=dmpdir dumpfile=wip.dmp logfile=wip.log tables=wip_runcard query=wip_runcard:'"where org_id=51 and time<to_date ('2011-01-01 00:00:00','yyyy-mm-dd hh24:mi:ss') and ship_time is not null and wip_route=999 and used_status=5"'

but error:

ORA-31693: Table data object "TEST"."WIP_RUNCARD" failed to load/unload and is being skipped due to error:
ORA-00907: missing right parenthesis

how to use expdp query paramter with time?

View 6 Replies View Related

SQL & PL/SQL :: Update Query Fail With Error - Missing Right Parenthesis

Feb 17, 2010

my update query seems to fail with error

ORA-00907: missing right parenthesis

Below is my test case:

create table t1(
sn varchar2(30),
inv_org number);
create table s1(
sn varchar2(30),
trx_date date,
inv_org number);

[code]...

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

PL/SQL :: WITH AS Results In ORA-00928 - Missing SELECT Keyword?

Aug 19, 2013

We are running on Oracle 10g. The following script results in ORA-00928: missing SELECT keyword. what causes this error? Both 'select' statements when run by themselves, complete successfully.

 [code]WITH A1 AS  WITH A1      AS (  SELECT MIN (VAPS_RPT_INTV_DMSN.INTV_DT),                   VAPS_RPT_INTV_DMSN.RPT_ID,                   VAPS_RPT_INTV_DMSN.RPT_INTV_ID              FROM APS.VAPS_RPT_INTV_DMSN, APS.VAPS_RPT_CL_INTV_DMSN             WHERE     APS.VAPS_RPT_INTV_DMSN.RPT_INTV_ID =                         

[code]./..

View 4 Replies View Related

SQL & PL/SQL :: Move Partition Of One Fact Table To Another?

Aug 30, 2011

I have two fact table and both are partitioned on same key and have same columns. Is it possible to move the partition of one fact table to another.

View 2 Replies View Related

SQL & PL/SQL :: Hash Partition On Fact Table

Sep 27, 2010

I created the 32 hash partition on a fact table. Based on hash parititon technique it should evenly distribute data accross the different partition.But when i analyze the table and check the distribution its not at all even.

P_Name Tabspace num_Rows
SYS_P21TBS_TBS0
SYS_P22TBS_TBS0
SYS_P23TBS_TBS0

[Code]....

View 5 Replies View Related

SQL & PL/SQL :: Data Transfer From Fact To History Table?

Aug 9, 2010

I need to transfer 6 million records from fact tables to history table .. What is the better and fast process to do that.

View 3 Replies View Related

SQL & PL/SQL :: Count Values From TOTAL_fault Column From Fact Table

Nov 22, 2012

I have two tables with below structures.

desc Fault_Dim
Name Null Type
------------------- -------- ------------------
KEY NOT NULL NUMBER(38)
SYSTEM_NAME VARCHAR2(3 CHAR)
PRIORITY VARCHAR2(40 CHAR)
SEVERITY VARCHAR2(40 CHAR)
TYPE VARCHAR2(40 CHAR)
STATUS VARCHAR2(40 CHAR)
CREATE_DT DATE
SUBTYPE VARCHAR2(255 CHAR)
[code]...

The Severity column has values as below 1,2,3, My requirement is to show results as in the attatched image.Where the count values are values from TOTAL_fault column from the fact table.

I believe this is possible in hierarchial queries and pivorting

View 1 Replies View Related

SQL & PL/SQL :: Table Is Missing In User_segments Data Dictionary Table

May 20, 2012

In my database I found some anomalies like

SQL> select SEGMENT_NAME, SEGMENT_TYPE, BLOCKS, EXTENTS, BYTES/1024
2 from user_segments
3 where SEGMENT_TYPE='TABLE'
4 ORDER BY SEGMENT_NAMe;
[code]....

The countries table is missing in user_segments data dictionary view.But I can queries the countries using select statement.

SQL> SELECT * FROM COUNTRIES;

CO COUNTRY_NAME REGION_ID
-- ---------------------------------------- ----------
AR Argentina 2
AU Australia 3
BE Belgium 1
BR Brazil 2
[code]...

why the country table is missing in user_segments data dictionary table.

View 8 Replies View Related

Performance Tuning :: Create Hash Partition On Fact Tables?

Aug 5, 2010

I have to create a hash partition on fact tables.. we can use temp tablespace or permanent tablespace.

View 10 Replies View Related

Getting Random Results Creating Table

Jan 19, 2012

I am trying to create a csv file with summarized data. We have a huge table with claim details that is constantly being updated. I am pulling a subset of records that match my criteria into a tempory table (not technically an Oracle temporary table, a regular table that will only exist until I drop it when I am done). This table has multiple entries per claim with different effective dates, paid dates and amounts paid. The result file needs to have one entry per claim with the oldest effective and paid dates and the total of all of the amounts paid on that claim.

Originally I was doing create table new_table as select claim_nbr,other data...,min(ymdeff),min(ymdpaid),sum(amtpay) from my_table group by claim_nbr,other data...

If I ran a select sum(amtpay) from my_table and select sum(amtpay) from new_table I was not getting the same results... If I ran select count (*) from (select distinct claim_nbr from my_table) and select count (*) from (select distinct claim_nbr from new_table) or select count (*) from new_table I was getting the same number of rows. So I wasn't completely losing claims from one table to the next, just some of the details. So, I tried running this:

select * from
(select claim_nbr,sum(amtpay) paysum from my_table
group by claim_nbr
order by claim_nbr) m,
(select claim_nbr,sum(amtpay) paysum from new_table
group by claim_nbr
order by claim_nbr) n
where
m.claim_nbr = n.claim_nbr and
m.paysum <> n.paysum;

It came back with the claim number causing the issue. I looked at all the entries in my_table for that claim and every field was identical except the ymdeff, ymdpaid and amtpay. There were 4 records in my_table however the amtpay in new_table was only a sum of 2 of the records... I our admin look over my shoulder to see what was wrong and they wanted me to recreate new_table. So I dropped new_table and ran the exact same SQL to recreate the table. The number of distinct claim numbers was still the same in both tables and the sum of new_table was off but not by the same amount. I ran my comparison to see which claim was off and now there were two claims where the totals didn't match and neither were the same as the claim that was wrong that first time. We dropped new_table and recreated it several times and every time we got different results... No one else knows the name of my_table so no one was messing with it at the same time plus the sum of amtpay in my_table always comes back the same.

Our admin said he thought he remembered there being something "funny" with the min function sometime so he had me remove those fields. Ran the query several times and the total came out correct each time. Well I still need the dates so I came up with another way (very convoluted) using subqueries and ranking. It seemed to work at first then it started losing random numbers of claims (fewer rows in new_table than distinct claims in my_table) or keeping all the claims but dropping detail lines like I had using the min functions.

Here is the backwards way around using min that drops whole claims sometimes but works fine other times:

CREATE table new_table
as
(select claim_nbr,other data...,amtpay,ymdeff,ymdpaid
from
(select claim_nbr,other data... ,sum(amtpay) amtpay
from my_table
group by claim_nbr,other data...

[Code] ...........

View 8 Replies View Related

SQL & PL/SQL :: Create Table By Using REF Cursor Results?

Oct 4, 2011

I want to create table by using the ref cursor results which is returned by the function / procedure. We need achieve this simple query .

View 17 Replies View Related

Create Table Not Replicating SQL Select Results?

May 10, 2012

I have a SQL statement that returns a set of columns...but...when I create table as <SQL statement> I get the same columns but with 2 of the columns containing each others data, e.g:

SQL Select:

COL1 COL2 COL3 COL4
___________________________________
AND10200000017805CG-4CG-3

Create Table as <SQL Select>:

COL1 COL2 COL3 COL4
___________________________________
AND10200000017805CG-3CG-4

The SQL Select is correct and the Create Table As <SQL Select> is wrong.

Here is my SQL:

Create table ALTERNATENUMBERS as
SELECT ctry,
id,
MAX(DECODE(tp,'EN', RN)) EN,
MAX(DECODE(tp,'RN', RN)) RN,
MAX(DECODE(tp,'AN', RN)) AN

[code]....

Unfortunately I cannot give you any data (too much of it) and small scale testing works, it's only when I run it on the 11million records do I get some (not all), just some of the data being mixed up between columns.

Now, I've tried:

1. Using SQLPLus - no joy

2. Creating the Table and then inserting the data into a blank table - also no joy

3. Using a VIEW - no joy, listagg doesn't work in VIEW tables

I do understand that without data it's hard to replicate the issue but why this statement works as a SELECT but when written to a table has data anomolies?

View 4 Replies View Related

PIVOT XML Results To HTML Table In SQLPlus?

Jul 27, 2012

I have a PIVOT XML query that returns results that I want to display as an HTML report from SQLPlus. Is there a way that this can be done readily? I have searched the net an found references to XML Publisher but in my current situation we do not have the product available.

View 4 Replies View Related

SQL & PL/SQL :: Query To Store Results - Update Values In Another Table?

Feb 22, 2010

I have a query like this -

SELECT
FIELD_A,
FN_FUNCTION(CARVE_ID, 1) FIELD_B,
FN_FUNCTION(CARVE_ID, 2) FIELD_C,
FN_FUNCTION(CARVE_ID, 3) FIELD_D,
FN_FUNCTION(CARVE_ID, 4) FIELD_E,
FN_FUNCTION(CARVE_ID, 5) FIELD_F,
FN_FUNCTION(CARVE_ID, 6) FIELD_G
FROM TB_CARVE;

When I execute the query, it returns the data (approx - 40,000 rows) in 1 min.But when I try to insert this data into another table (or create a table of this data) it takes me about 2 hours.

Tried using Materialized view, its again the same the refresh takes 2 hours.Basically here, what I am trying to do is the data from the above query is used to update the values in another table.What ever the procedure I am trying it takes 2 hours.

View 6 Replies View Related

Find Missing Data From Parent Table?

Aug 8, 2013

SELECT c.table_name CHILD_TABLE, p.table_name PARENT_TABLE
FROM user_constraints p, user_constraints c
WHERE (p.constraint_type = 'P' OR p.constraint_type = 'U')
AND c.constraint_type = 'R'
AND p.constraint_name = c.r_constraint_name
AND c.table_name = UPPER('ODS_TSAF_MES_PC');

and output is

child table parent table
ODS_TSAF_MES_PC ODS_TSAF_MES_PCTYP
ODS_TSAF_MES_PC ODS_TSAF_MES_PC
ODS_TSAF_MES_PC ODS_TSAF_MES_PCSTAT

i tried

SELECT A.piecestatus from ods_TSAF_MES_PCSTAT A WHERE NOT EXISTS
(SELECT * FROM ODS_TSAF_MES_PC B WHERE B.piecestatus = A.piecestatus);

and i found one piecestatus values is 'I' but i am not getting where it is related to the table and in which row it is getting affected?

View 6 Replies View Related

SQL & PL/SQL :: Creating Table - Missing Or Invalid Option Error

Jun 10, 2011

I am getting error while trying to create a table

SQL>
SQL> CREATE OR REPLACE TABLE CEE_OSPCM_DETAILS
2 (
3 ORD_NBR VARCHAR2(10) NOT NULL,
4 ORD_APPNDX NUMBER(2) NOT NULL,
5 FRCOI_NBR NUMBER,
6 PRINT_NBR VARCHAR2(4),

[code]....

View 3 Replies View Related







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