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
4 3055
Can you kindly post your query that you are working on with the table structure for reference of our experts.
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?
Can you kindly post your query that you are working on with the table structure for reference of our experts.
Ok, -
-
Select To_Char (Sysdate, 'Mm/Dd/Yy Hh24mi') Todays_Date,
-
B.Ins_Co_Name,
-
B.Ins_Co_Address2,
-
B.Ins_Co_City,
-
B.Ins_Co_State,
-
B.Ins_Co_Zip,
-
B.Pat_Lname| |','| |B.Pat_Fname| |' '| |Pat_Middle_Initial Name,
-
G.Claim,
-
G.Trans_Cd,
-
G.Entry_Date Bill_Date,
-
G.Trans_Date,
-
G.Billed,
-
G.Payment,
-
G.Adjustments,
-
G.Jag,
-
G.Totals,
-
G.Dummy
-
From I_Arc_Permanent_Bill B,
-
(Select
-
Substr(G.Cntrl_No,1,10) Claim,
-
G.Trans_Cd,
-
G.Entry_Date Bill_Date,
-
G.Trans_Date,
-
Sum( Decode(Substr(G.Trans_Cd,1,2),'01',G.Debit_Amount,0)) Billed,
-
Sum( Decode(Substr( G.Trans_Cd,1,1), 'R', G.Credit_Amount, 0)) Payment,
-
Sum( Decode(Substr( G.Trans_Cd,1,1), 'W', G.Credit_Amount, 0)) Adjustments,
-
Sum( Decode(Substr(G.Trans_Cd,1,1),'U',G.Credit_Amount,0)) Jag,
-
Sum(G.Credit_Amount) Totals,
-
Sum(0) Dummy
-
From I_Arc_General_Ledger G
-
Where G.Entry_Date Between Trunc(Sysdate) -210 And Trunc(Sysdate) -120
-
And Substr(G.Trans_Cd,1,2) !='AU'
-
Group By G.Cntrl_No, G.Trans_Cd, G.Entry_Date, G.Trans_Date
-
Having Sum( Decode(Substr(G.Trans_Cd,1,1), 'U', Credit_Amount, 0)) !=0
-
) G
-
Where G.Cntrl_No = B.Cntrl_No
-
And B.Status = 'OPEN'
-
/
-
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. -
-
Select To_Char (Sysdate, 'Mm/Dd/Yy Hh24mi') Todays_Date,
-
B.Ins_Co_Name,
-
B.Ins_Co_Address2,
-
B.Ins_Co_City,
-
B.Ins_Co_State,
-
B.Ins_Co_Zip,
-
B.Pat_Lname| |','| |B.Pat_Fname| |' '| |Pat_Middle_Initial Name,
-
G.Claim,
-
G.Trans_Cd,
-
G.Entry_Date Bill_Date,
-
G.Trans_Date,
-
G.Billed,
-
G.Payment,
-
G.Adjustments,
-
G.Jag,
-
G.Totals,
-
G.Dummy
-
From I_Arc_Permanent_Bill B,
-
(Select
-
Substr(G.Cntrl_No,1,10) Claim,
-
G.Trans_Cd,
-
G.Entry_Date Bill_Date,
-
G.Trans_Date,
-
Sum( Decode(Substr(G.Trans_Cd,1,2),'01',G.Debit_Amount,0)) Billed,
-
Sum( Decode(Substr( G.Trans_Cd,1,1), 'R', G.Credit_Amount, 0)) Payment,
-
Sum( Decode(Substr( G.Trans_Cd,1,1), 'W', G.Credit_Amount, 0)) Adjustments,
-
Sum( Decode(Substr(G.Trans_Cd,1,1),'U',G.Credit_Amount,0)) Jag,
-
Sum(G.Credit_Amount) Totals,
-
Sum(0) Dummy
-
From I_Arc_General_Ledger G
-
Where G.Entry_Date Between Trunc(Sysdate) -210 And Trunc(Sysdate) -120
-
And Substr(G.Trans_Cd,1,2) !='AU'
-
Group By G.Cntrl_No, G.Trans_Cd, G.Entry_Date, G.Trans_Date
-
Having Sum( Decode(Substr(G.Trans_Cd,1,1), 'U', Credit_Amount, 0)) !=0
-
) G
-
Where G.Cntrl_No = B.Cntrl_No
-
And B.Status = 'OPEN'
-
/
-
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
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
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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.
...
|
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,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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$) {
}
...
|
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...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
| |