473,385 Members | 1,813 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Oracle query help urgent !!

Hi,

This is the query i am trying to build

I have attached the same in the file....


while running its throwing an error ........

NVL((SELECT USAGEMODE FROM KKTYPEMAST_AP B WHERE B.TYPE_ID_USG=A.TYPE_ID_USG AND
B.JURISDICTION=A.JURISDICTION),(SELECT USAGEMODE FROM KKTYPEMAST_AP B WHERE B.T
YPE_ID_USG=A.TYPE_ID_USG AND ROWNUM=1)),
*
ERROR at line 15:
ORA-06550: line 15, column 6:
PLS-00103: Encountered the symbol "SELECT" when expecting one of the following:
( - + mod not null others <an identifier>
<a double-quoted delimited-identifier> <a bind variable> avg
count current exists max min prior sql stddev sum variance
execute forall time timestamp interval date
<a string literal with character set specification>
<a number> <a single-quoted SQL string>
ORA-06550: line 15, column 112:
PLS-00103: Encountered the symbol "," when expecting one of the following:
; return returning and or
ORA-06550: line 15, column 199:
PLS-00103: Encountered the symbol ")" when expecting one of the following:
, ; for <an identifier>
<a double-quoted delimited-identifier> group having intersect
minus order start union where connect
ORA-06550: line 18, column 5:
PLS-00103: Encountered the symbol "(" when expecting one of the following:
. , @ ; for <an identifier>
<a double-quoted delimited-identifier> group having intersect
minus order p



Pls help me for the error
Attached Files
File Type: txt tmp_kk_rev.txt (2.6 KB, 484 views)
Sep 18 '09 #1
1 3116
amitpatel66
2,367 Expert 2GB
You did not give the Alias name to the NVL functions:

Expand|Select|Wrap|Line Numbers
  1. SELECT BILL_REF_NO,
  2.        USAGEMODE,
  3.        BILLED_AMOUNT,
  4.        DISCOUNT,
  5.        SOU,
  6.        UNITS 
  7. FROM (
  8. SELECT
  9. A.BILL_REF_NO,
  10. NVL(
  11.     (SELECT USAGEMODE 
  12.      FROM KKTYPEMAST_AP B 
  13.      WHERE B.TYPE_ID_USG=A.TYPE_ID_USG
  14.      AND B.JURISDICTION=A.JURISDICTION),
  15.     (SELECT USAGEMODE 
  16.      FROM KKTYPEMAST_AP B 
  17.      WHERE B.TYPE_ID_USG=A.TYPE_ID_USG 
  18.      AND ROWNUM=1)
  19.    ) usagemode,
  20. A.BILLED_AMOUNT,
  21. A.DISCOUNT,
  22. NVL2(
  23.      (SELECT 1 
  24.       FROM 
  25.       KKTYPEMAST_AP 
  26.       WHERE TYPE_ID_USG=A.TYPE_ID_USG 
  27.       AND (UPPER(TYPEDESC) LIKE '%MARKUP%' OR UPPER(TYPEDESC) LIKE '%TAX%' OR (UPPER(TYPEDESC) LIKE '%PSTN%' 
  28.       AND TYPE_ID_USG LIKE '%2')) 
  29.       AND ROWNUM=1),A.SOU,0
  30.     ) sou,
  31. NVL2(
  32.      (SELECT 1 
  33.       FROM KKTYPEMAST_AP 
  34.       WHERE TYPE_ID_USG=A.TYPE_ID_USG 
  35.       AND (UPPER(TYPEDESC) LIKE '%MARKUP%' OR UPPER(TYPEDESC) LIKE '%TAX%' 
  36.       OR (UPPER(TYPEDESC) LIKE '%PSTN%' AND TYPE_ID_USG LIKE '%2')) 
  37.       AND ROWNUM=1),A.UNITS,0
  38.     ) units
  39. FROM (SELECT /*+ ordered*/       CB.ACCOUNT_NO,
  40.       CB.SUBSCR_NO,
  41.       CB.SUBSCR_NO_RESETS,
  42.       CB.BILL_REF_NO,
  43.       CB.BILL_REF_RESETS,
  44.       CB.TYPE_ID_USG,
  45.       CD.JURISDICTION,
  46.       SUM(CB.BILLED_AMOUNT)/100  BILLED_AMOUNT,
  47.       SUM(CB.DISCOUNT)/100 DISCOUNT,
  48.       SUM(PRIMARY_UNITS) SOU,
  49.       SUM(CD.RATED_UNITS) UNITS
  50.       FROM 
  51.           CD_CU4@CU4 CD,
  52.           CB_CU4@CU4 CB
  53.      WHERE CD.CDR_DATA_PARTITION_KEY=CB.CDR_DATA_PARTITION_KEY
  54.      AND CD.MSG_ID=CB.MSG_ID
  55.      AND CD.MSG_ID2=CB.MSG_ID2
  56.      AND CD.MSG_ID_SERV=CB.MSG_ID_SERV
  57.      AND CD.SPLIT_ROW_NUM=CB.SPLIT_ROW_NUM
  58.      AND (CB.BILL_REF_NO,CB.BILL_REF_RESETS) IN (SELECT BILL_REF_NO,BILL_REF_RESETS FROM KK_MOU_DUMP_CU4)
  59.      GROUP BY          CB.ACCOUNT_NO,
  60.          CB.SUBSCR_NO,
  61.          CB.SUBSCR_NO_RESETS,
  62.          CB.BILL_REF_NO,
  63.          CB.BILL_REF_RESETS,
  64.          CB.TYPE_ID_USG,
  65.          CD.JURISDICTION) A);
  66.  
Sep 23 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: francis70 | last post by:
Hi, I have these 2 problem? Is there a way in Oracle to read UNCOMMITED data. i.e. in Oracle the normal behaviour is that a user's updates to a table are visible to other users ONLY when the...
11
by: Markus Breuer | last post by:
I have a question about oracle commit and transactions. Following scenario: Process A performs a single sql-INSERT into a table and commits the transaction. Then he informs process B (ipc) to...
1
by: Cern | last post by:
Is it somebody out there who has made a migration from an Oracle server to an MySQL server?? The scenario is as simply: I've got a Oracle 8 server with a database with content that I want to...
4
by: robboll | last post by:
When I try to use an append query from an oracle link it takes forever. I am exploring the idea of doing an append action using a pass-through query. If I have an Oracle ODBC connection to...
0
ekekakos
by: ekekakos | last post by:
Hello, I am having a serious and urgent problem with the character settings of an oracle database. The database is sitting in a solaris unix server and when we run the env command we have the...
5
by: jonceramic | last post by:
Hi All, I started developing in Access, and people took notice and so we're starting to migrate into our corporate's bigger Oracle system. I'll still be using my developed Access front ends,...
1
by: guestlove | last post by:
How can I say if my command is executed succesfully on a shell. How can I read a file using a shell script. How can I distinguish Row and a Column in that script How can I handle errors in...
2
by: Vinod Sadanandan | last post by:
All, Below listed are the new features in Oracle 11g ,please join me in this discussion to generate a testcase and analyze each of the listed features . Precompilers:...
1
by: musai | last post by:
Hi Members I have created VB/Oracle Application Application is going to use multiple client (user machine) What I want to know is whether Oracle should be installed or not. I checked two...
4
by: musai | last post by:
I have created vb oracle application I installed oracle client in three machine. All machine was reconfigured after oracle installed I could see table and record set through sql plus sheet in...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.