473,387 Members | 3,821 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,387 software developers and data experts.

SQL Plus

I'm using SQL Plus 10.2 to query an oracle 10G db.
The script I have works great except several of the insurance company names begin with the same phrase before adding the additional identifier. Then other insurance company names then follow alphabetically.
For example BCBS OF NC Employee,BCBS OF NC Federal,BCBS OF NC State,
then a different insurance company CAREMARk, then MailHandlers.
I'm using Group By Ins_Co_name so all the BCBS prints as one and all the MailHandlers prints as one.
How do I break out the different Insurance carriers so they print as they should ?
I have setup a variable that prints the Ins_Co_name, address,city,state in a header and then the respective claims print below that header.
Sorry to make this lengthy.
Thanks in advance
Sep 13 '08 #1
4 3055
debasisdas
8,127 Expert 4TB
Can you kindly post your query that you are working on with the table structure for reference of our experts.
Sep 13 '08 #2
Dave44
153 100+
could you use a case statement to substring the name and if its BCBS use the rest of the string to sort otherwise use the whole field? something like that?
Sep 13 '08 #3
Can you kindly post your query that you are working on with the table structure for reference of our experts.
Ok,
Expand|Select|Wrap|Line Numbers
  1.  
  2. Select To_Char (Sysdate, 'Mm/Dd/Yy Hh24mi') Todays_Date,
  3.     B.Ins_Co_Name,      
  4.     B.Ins_Co_Address2,
  5.     B.Ins_Co_City,
  6.     B.Ins_Co_State,
  7.     B.Ins_Co_Zip,
  8.     B.Pat_Lname| |','| |B.Pat_Fname| |' '| |Pat_Middle_Initial Name,             
  9.     G.Claim,
  10.     G.Trans_Cd,
  11.     G.Entry_Date Bill_Date,
  12.     G.Trans_Date,
  13.     G.Billed,
  14.     G.Payment,
  15.     G.Adjustments,
  16.     G.Jag,
  17.     G.Totals,
  18.     G.Dummy
  19. From I_Arc_Permanent_Bill B,
  20. (Select
  21.     Substr(G.Cntrl_No,1,10) Claim,
  22.     G.Trans_Cd,
  23.     G.Entry_Date Bill_Date,
  24.     G.Trans_Date,
  25.     Sum( Decode(Substr(G.Trans_Cd,1,2),'01',G.Debit_Amount,0))  Billed,
  26.     Sum( Decode(Substr( G.Trans_Cd,1,1), 'R', G.Credit_Amount, 0)) Payment,
  27.     Sum( Decode(Substr( G.Trans_Cd,1,1), 'W', G.Credit_Amount, 0))  Adjustments,
  28.     Sum( Decode(Substr(G.Trans_Cd,1,1),'U',G.Credit_Amount,0)) Jag,
  29.     Sum(G.Credit_Amount) Totals,
  30.     Sum(0) Dummy
  31.    From I_Arc_General_Ledger G
  32.   Where G.Entry_Date Between Trunc(Sysdate) -210 And Trunc(Sysdate) -120
  33.     And Substr(G.Trans_Cd,1,2) !='AU'
  34.   Group By  G.Cntrl_No, G.Trans_Cd, G.Entry_Date, G.Trans_Date
  35.  Having Sum( Decode(Substr(G.Trans_Cd,1,1), 'U', Credit_Amount, 0)) !=0
  36. ) G
  37. Where G.Cntrl_No = B.Cntrl_No
  38.   And B.Status   = 'OPEN'
  39. /
  40.  
Sep 14 '08 #4
could you use a case statement to substring the name and if its BCBS use the rest of the string to sort otherwise use the whole field? something like that?
Dave,
I'm not sure you can do that in SQL Plus.
Here is the code.
Expand|Select|Wrap|Line Numbers
  1.  
  2. Select To_Char (Sysdate, 'Mm/Dd/Yy Hh24mi') Todays_Date,
  3.     B.Ins_Co_Name,      
  4.     B.Ins_Co_Address2,
  5.     B.Ins_Co_City,
  6.     B.Ins_Co_State,
  7.     B.Ins_Co_Zip,
  8.     B.Pat_Lname| |','| |B.Pat_Fname| |' '| |Pat_Middle_Initial Name,             
  9.     G.Claim,
  10.     G.Trans_Cd,
  11.     G.Entry_Date Bill_Date,
  12.     G.Trans_Date,
  13.     G.Billed,
  14.     G.Payment,
  15.     G.Adjustments,
  16.     G.Jag,
  17.     G.Totals,
  18.     G.Dummy
  19. From I_Arc_Permanent_Bill B,
  20. (Select
  21.     Substr(G.Cntrl_No,1,10) Claim,
  22.     G.Trans_Cd,
  23.     G.Entry_Date Bill_Date,
  24.     G.Trans_Date,
  25.     Sum( Decode(Substr(G.Trans_Cd,1,2),'01',G.Debit_Amount,0))  Billed,
  26.     Sum( Decode(Substr( G.Trans_Cd,1,1), 'R', G.Credit_Amount, 0)) Payment,
  27.     Sum( Decode(Substr( G.Trans_Cd,1,1), 'W', G.Credit_Amount, 0))  Adjustments,
  28.     Sum( Decode(Substr(G.Trans_Cd,1,1),'U',G.Credit_Amount,0)) Jag,
  29.     Sum(G.Credit_Amount) Totals,
  30.     Sum(0) Dummy
  31.    From I_Arc_General_Ledger G
  32.   Where G.Entry_Date Between Trunc(Sysdate) -210 And Trunc(Sysdate) -120
  33.     And Substr(G.Trans_Cd,1,2) !='AU'
  34.   Group By  G.Cntrl_No, G.Trans_Cd, G.Entry_Date, G.Trans_Date
  35.  Having Sum( Decode(Substr(G.Trans_Cd,1,1), 'U', Credit_Amount, 0)) !=0
  36. ) G
  37. Where G.Cntrl_No = B.Cntrl_No
  38.   And B.Status   = 'OPEN'
  39. /
  40.  
Sep 14 '08 #5

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

Similar topics

1
by: Ruben Schoenefeld | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi - after I got sql*plus to work on my Linux box and I recompiled PHP 5 to include the oracle instant client, I run into a weird problem: I...
3
by: Carlos Ribeiro | last post by:
I was checking the Prolog recipe in the Cookbook: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/303057 It's a clever implementation that explores some aspects of Python that I wasn't...
6
by: Gerry Viator | last post by:
Hi all, I have a textbox were a time is typed in like: upto 4 numbers 1900 300 1000 1425 I would like as they type the text to show todays date plus the time they
1
by: Jacob Grydholt Jensen | last post by:
I am trying to learn iSQL*Plus for the 1Z0-007 exam. I am having a bit of problems with the substitution variables. My understanding was that they behave as in SQL*Plus, but my experiments beg to...
1
by: Miori | last post by:
Dear all, Server machine running Oracle Database Server on Linux and a Client machine running Oracle Client on WIndows XP. HOw it is possible to shut down/start up the Oracle database on the...
2
by: Ant | last post by:
Hi, I have an SQL assignment to do and at my school we use SQL *Plus there however I don't have Oracle at home, where I would like to do the work ,so I was wondering whats the easiest way to get...
0
by: Emil Georgiev | last post by:
Hell I have a Web Custom Control project in ASP.NET. I'm using a subclassing technique to add functionality in HyperLink web server control. I want to create a property "BrowserWindow" of my...
10
by: Mitoshima | last post by:
The group "Makers Of Video Games" will be releasing a game code named Tic Tac Toe Plus. Tic Tac Toe Plus is a game which will utilize the same simple rules and gameplay as the very popular Tic...
2
by: pbd22 | last post by:
Hi. Can somebody tell me how to prevent a postback when I click on the little "plus" sign next to the treenode's root folder? It postbacks and I have to restart a video stream coming to the...
5
by: Gushe | last post by:
Hello all. Well, Since I have this Msn Plus! Live, I was very exited about the scripts system. I was also very obsessed with scripting, So I decided to try learning the Msn Plus! Live scripting. ...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.