Back with another question
Hello all,
I've created a custom table by using a PL/SQL anonymous block as my report. However I have noticed that I no longer have the ability to sum my rows or columns and I can't export to Excel.
I had to create my own table as I could not format it by simply using a PL/SQL or SQL report. So I opted for creating an HTML table.
Does anyone know if it is possible to incorporate both a sum of rows and an export to excel using a PL/SQL anonymous block?
Does anyone have any links to an example? Thank you!
The code for my table is as follows(many might have already seen from previous posts).
declare
apps1 varchar2(75);
noper varchar2(10) := '0.0';
day date;
day2 date;
cursor c_apps is
SELECT DISTINCT APPS
FROM OUTAGE_1
WHERE INSTR(':'||:P4_SYSTEMS||':',':'||APPS||':') > 0
OR :P4_SYSTEMS LIKE '%-1%'
AND NOTABLE = 'N' /*excluding notable events*/
AND METRICS = 'Y' /*include outages where metrics is yes*/
order by 1;
cursor c_per (perAppId in varchar2)is
SELECT dates_apps.day2, /*obtaining day from dates_apps temp table below*/
dates_apps.apps,/*obtaining apps from dates_apps temp table below*/
nvl(trunc(the_totals.percent,2),0)Percent /*obtaining percentages from the_totals*/
FROM
SELECT APPS,
trunc(START_DATE)day2,
SUM (TOTAL_HOURS)*100/TRUNC(((TO_DATE (:P4_END_DATE, 'MM/DD/YYYY') - TO_DATE(:P4_START_DATE, 'MM/DD/YYYY')+1)*24))percent
FROM OUTAGE_1
WHERE APPS = perAppId
GROUP BY APPS,
trunc(START_DATE))the_totals,
/*end of temp table the_totals - obtaining apps and percentages*/
SELECT the_app.apps,
the_dates.day2
FROM(
SELECT DISTINCT APPS
FROM OUTAGE_1
WHERE APPS = perAppId)the_app,
/*end of temp table the_app - obtaining distinct apps */
SELECT TRUNC (TO_DATE (:P4_START_DATE, 'MM/DD/YYYY') + LEVEL - 1)day2
FROM dual
CONNECT BY LEVEL <=TRUNC (TO_DATE (:P4_END_DATE, 'MM/DD/YYYY'))
- TRUNC (TO_DATE (:P4_START_DATE, 'MM/DD/YYYY')) +1 )the_dates
/*end of temp table the_dates - looping through dates based on user input dates */
)dates_apps
/*end of dates_apps temp table*/
WHERE dates_apps.apps = the_totals.apps(+)
AND dates_apps.day2 = the_totals.day2(+)
AND dates_apps.apps like '%'
order by 1,2;
begin
htp.p('<table BORDER="1" CELLSPACING="0" CELLPADDING="0" WIDTH="100%">');
htp.p('<tr BGCOLOR="#FF0000">');
htp.p('<th>DAY</th>');
for i in (SELECT TRUNC (TO_DATE (:P4_START_DATE, 'MM/DD/YYYY') + LEVEL - 1)day
FROM dual
CONNECT BY LEVEL <=TRUNC (TO_DATE (:P4_END_DATE, 'MM/DD/YYYY')) - TRUNC (TO_DATE (:P4_START_DATE, 'MM/DD/YYYY')) +1 )
loop
htp.p('<th>' ||i.day||'</th>');
end loop;
htp.p('</tr>');
htp.p('<tr BGCOLOR="#FF0000">');
for i in c_apps
loop
htp.p('<tr>');
htp.p('<th>' ||i.apps||'</th>');
for k in c_per (i.apps)
loop
htp.p('<th>' ||k.percent||'</th>');
end loop;
htp.p('</tr>');
end loop;
end;
you are welcome
Thanks
Michael Altringer
Altringer & Associates Inc
Fine Wood Floors
www.anainc.net
612-940-8749
Youngevity 90 for Life
Similar Messages
-
Yes, I'm back with another question.
Hi again. I have to tell you, first, that my site is coming along quite well. However, I am having some difficulty in figuring out how to get a graphic to repeat itself, (tile) within a certain area. I am sure there is a tutorial, somewhere, that tells how to do this. If someone could steer me in the right direction I will be extremely grateful.
Sueyou are welcome
Thanks
Michael Altringer
Altringer & Associates Inc
Fine Wood Floors
www.anainc.net
612-940-8749
Youngevity 90 for Life -
A newbie with another question
Sorry for my ignorance, but I'm just in my first semester of programming. I'm confused as to what syntax is required when you use classes with a couple of methods inside? In one of my programs, our professor provided us with a file called Zipfstatistics.class and though he told us that the two methods are Slope(wordFrequency) and RSquared(wordFrequency), I can't seem to compile them properly. I've tried compiling them as text.Slope(wordFrequency) and text.RSquared(wordFrequency) respectively and both produce compiler errors. Does anyone have a solution to this problem?
Thanks again people.Here is the code.
import java.awt.Font;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.lang.reflect.Array;
import java.util.Random;
import java.util.regex.Pattern;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextArea;
import javax.swing.table.DefaultTableModel;
* @author jobuck
public class WordFrequency {
private JTextArea ta = null;
private JFrame frame = null;
private JScrollPane tableScrollpane = null;
private JScrollPane resultScrollpane = null;
private JTable table = null;
private final int MAX_LENGTH = 12;
private final int MAX_WORD = 1000;
private final int WORD_PER_LINE = 25;
private Random random = new Random();
private final char WORD_SEPARATOR = ' ';
private Pattern pattern = Pattern.compile("\\p{Alnum}");
private TableModel tableModel = null;
public WordFrequency() {
tableModel = new TableModel();
table = new JTable(tableModel);
frame = new JFrame("Word Frequency");
JTextArea result = tableModel.getTextAreaFrenquency();
tableScrollpane = new JScrollPane(table);
resultScrollpane = new JScrollPane(result);
Box box = new Box(BoxLayout.Y_AXIS);
box.add(resultScrollpane);
box.add(tableScrollpane);
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent evt) {
System.exit(0);
frame.getContentPane().add(box);
frame.setSize(800, 400);
frame.setVisible(true);
public static void main(String[] args) {
WordFrequency df = new WordFrequency();
private class TableModel extends DefaultTableModel {
//Even if we don't need to compute words, as we
//only have interest on there length, let's do it anyway
private final char[] validChars =
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
'w', 'x', 'y', 'z', '0', '1', '2', '3',
'4', '5', '6', '7', '8', '9', ';', '.'
private String[][] values =
(String[][]) Array.newInstance(
String.class,
new int[] { MAX_WORD / WORD_PER_LINE + 1, WORD_PER_LINE });
private int maxWordLength = 0;
private int[] frequencyLength =
(int[]) Array.newInstance(int.class, new int[] { MAX_LENGTH + 1 });
public TableModel() {
generateText();
private void generateText() {
int col = 0;
int row = 0;
int wordLength = 0;
char wordChar;
for (int i = 0; i < MAX_WORD; i++) {
StringBuffer text = new StringBuffer();
wordLength = random.nextInt(MAX_LENGTH + 1);
for (int j = 0; j < wordLength; j++) {
wordChar =
(char) validChars[random.nextInt(validChars.length)];
text.append(wordChar);
row = i % WORD_PER_LINE;
col = (i > 0 && row == 0) ? col + 1 : col;
values[col][row] = text.toString();
frequencyLength[wordLength] += 1;
maxWordLength =
(maxWordLength < frequencyLength[wordLength])
? frequencyLength[wordLength]
: maxWordLength;
for (int i = 0; i < MAX_LENGTH + 1; i++)
System.out.println(
"frequency(" + i + ") : " + frequencyLength);
private String getResult() {
int[] frequency = getFrequency();
StringBuffer frequencyGraph = new StringBuffer();
System.out.println("getMaxWordLength()=" + getMaxWordLength());
boolean isDC = false; //Just show the shape, removing
boolean exit = false; //Just show the shape
int dc = 0;
for (int i = getMaxWordLength();(i >= 0) & !exit; i--) {
exit = true;
//Vertical axis
//TODO: adapt to frequency length to avoid banana axis
frequencyGraph.append("\n"+i+" + ");
for (int j = 0; j < MAX_LENGTH + 1; j++) {
isDC = (frequency[j] >= i);
exit &= isDC;
frequencyGraph.append((!isDC) ? " " : " * ");
dc = (exit)?i:0;
frequencyGraph.append("\n");
String space = "";
//Space starting the x axis
for (int i = 0;i<String.valueOf(dc).length()+3;i++)
space+=" ";
frequencyGraph.append(space.substring(2));
//Horizontal axis
for (int j = 0; j < MAX_LENGTH + 1; j++) {
frequencyGraph.append("+++");
frequencyGraph.append("++");
//Frequency
frequencyGraph.append("\n");
for (int j = 0; j < MAX_LENGTH + 1; j++) {
frequencyGraph.append( (j==0)?space +" " + j + " ": ((j<10)?" " + j + " ": " "+j) );
return frequencyGraph.toString();
public JTextArea getTextAreaFrenquency() {
JTextArea ta = new JTextArea(getResult());
ta.setFont(new Font("Monospaced",Font.PLAIN,10));
return ta;
private int getMaxWordLength() {
return maxWordLength;
public String[][] getValues() {
return values;
public int[] getFrequency() {
return frequencyLength;
public int getRowCount() {
return MAX_WORD / WORD_PER_LINE + 1;
public int getColumnCount() {
return WORD_PER_LINE;
public String getColumnName(int column) {
return column + "";
public boolean isCellEditable(int rowIndex, int columnIndex) {
return true;
public Object getValueAt(int row, int column) {
return values[row][column];
public void setValueAt(Object value, int row, int column) {
values[row][column] = (String) value; -
Another question - I'm sorry!
I'm sorry to bother you guys with another question. =p Just a quickie- How exactly do I get a movie from a DVD onto my computer after putting it in the drive? This is probably another stupid question, haha. ^_^; But I honestly haven't a clue.
THANK YOU in advance!! =)It may be a quick question... but there's certainly no quick answer to it.
The topic of DVD ---> iPod has been covered thoroughly in these forums already. There's literally hundreds of topics which answer your question for you.
I would suggest that you search through the forums to find your answer, rather than start a whole new topic with duplicate information. -
Thanks all for the great advice. Another question. If I use Entourage on my Mac desktop to access my mail using an email address I have on there, is it possible to access my emails on that same email address on my iPad, either with or without using Entourage. Is there an Entourage app, or something I could use? Thanks...
Simply add the email account to Mail, no need for Entourage.
One word of warning, though, iPads tend to become community property (meaning anyone who uses your iPad can access your email). That is why I have zero email accounts on my iPad.
I use Entourage on my desktop as well, so going back and forth between Entourage and Mail (whether on your iPad or iPhone) is no problem. -
I got the new ipad several weeks ago, and since i had the ipad 2 before it, i transfered the data from it to my computer and gave the ipad 2 (techinally new since it had nothing on it) to a family member. Now, when I go to itunes on my computer with the new ipad, it says that the computer has already been synced with another device, and my only two options are to set the ipad up as a new one or to restore from a backup (my up-to-date backup for the new ipad does not come up on itune's list of backups that went to my computer). So now because of this, there is no way i can put anything from my computer to the ipad, or even look at it through Itunes on the computer! Is there any other option for me?! I need help now!!
I found this article some time ago when I was trying to help someone else in this same situation. This is a copy and paste from the website. The website is provided below for you to read before you try this.
Plug your phone into iTunes
Click setup as a new device
Immediately unplug your phone from the computer
Give it about 30 seconds and iTunes will give a message (I don’t remember the specific, but regarding you unplugging the device and it not completing)
Plug your phone back in
Viola! no restore occurred and you can access everything again
This computer has previously synced with an iPhone or another iOS device. -
Since upgrading to Mavericks, 10.9.1, pictures that come attached to emails no longer display. There is only a blank space that after about 1 minute, has a small box with a question mark. Double clicking on the box will open the image in a separate window. It's very slow and tedious for multiple images. How can I go back to attached and displayed images? If I click on "Forward", the images appear instantly in the email to be forwarded.
Scott,
My problem seemed to fix itself. Or, by shutting down the computer one night, instead of putting it to sleep, may have reset something. Since updating to Mavericks, I always (or usually) let the computer sleep overnight or anytime I'm walking away from it. A few days ago, I was updating notes for my kids about how to find all my stuff and how to turn on my computer, so I wanted to rewrite the start-up procedures for the iMac, just in case they ever need to. Well, I shut it down one night so the following morning, I could write down each step. Lo and behold, the images, etc. are all there again! Solved, but I'm not sure why.
Tom -
Hi, do you know how can I upload inelegible songs from itunes to Icloud. They are songs added from original CDs. Another question would be how can I transfer all the music I have in my Ipod Classic to my Itunes or ICloud as I want to back it up.
Depends on why it's ineligible. If it's under 96 Kpbs, try right-clicking on the file and choosing Create AAC Version. (If you don't see this option, go to iTunes>Preferences, click "Import Settings..." then choose "Import Using: AAC Encoder" and "Setting: iTunes Plus".) Then rescan your library to see if this version will add to iTunes Match. Or, after changing your import setting, just re-import the song to your iTunes library.
If the song is over 200 MB you would have to reduce it's size to make it eligible. -
i have 2 ipods. one was synced with my computer before it crashed. now i have my computer back and i am trying to sync both so we can share music. it wont let me put the songs from the one before in my library because it says its already synced with another library. how do i change and get it so the music from both can be shared?
See:
Syncing to a "New" Computer or replacing a "crashed" Hard Drive: Apple Support Communities -
I downloaded apps purchased with another Apple ID. But my data is missing. What can I do to get them back? I have a different iCloud id.
All apps are tied forever to the Apple ID used to obtain them, that is also true with In-App purchases.
Content bought using one Apple ID cannot be merged or transferred to another Apple ID. -
I have had to restore my pc to a place back in time when it worked correctly. This meant that iTunes was deleted. I have now downloaded the latest version of iTunes but I cant sync my iPad with it. I get the message that this iPad is synced with another iTunes Library and cant sync to this one. Thankfully all my music library is on iPad. I would be grateful for some help on this issue
Its solved I just restored it to that point
-
I plugged my iPod into the computer and it says that my iPod is synced with another iTunes library, but it's not. So all my music and apps are gone. What can I do to remind the computer its the right iTunes library and get all my stuff back?
Same as you would if you bought a pc; copy everything from your old computer to your new one. Then you can just sync everything from the new computer, as you did with the old one.
-
My iPhone 4s screen is cracked (due to being dropped) and I can't slide to unlock it. Several of the the icons on screen will not work either. Is there a way to recover my photos if the phone has never had a back up and never been synced with another device?
kitts1979 wrote:
My iPhone 4s screen is cracked (due to being dropped) and I can't slide to unlock it. Several of the the icons on screen will not work either. Is there a way to recover my photos if the phone has never had a back up and never been synced with another device?
No in order to backup to iTunes, you would need to unlock your phone.
In order to import pics to your computer you would need to unlock your phone. -
my computer has some serious problems, my iphoto only shows only shows thumb size pics when I try to open them, i tried to rebuild my files from folders that had the pics in them. originally all the photos had a large delta with a question mark. also I can't back up the library file because its not there. I went to time machune and tried to find the file but I can't find it or I am looking in the wrong place. I also lost my Idvd file, only have broken chain showing.
Details please
What version of iPhoto and of the OS?
i tried to rebuild my files from folders that had the pics in them.
Exactly what did you do and how did you do it? this ay be the cause of your issue but without details we can n=ony guess
my iphoto only shows only shows thumb size pics when I try to open them,
where do you see htis? In the iPhoto window? what does "try to pen them" exactly mean?
originally all the photos had a large delta with a question mark.
Ok - this usually has a simple solution - do you still have a copy of the library that has this problem?
also I can't back up the library file because its not there.
This makes no sense at all - all of your previous statements indicate that you do have an iPhoto library but have some problems with it
By default your iPHoto library is located in your Pictures folder and is named iPhtoo library - if tha tis not the case the you have moved or renamed it and only you know what you did until you tell us the details
I went to time machune and tried to find the file but I can't find it or I am looking in the wrong place.
Again unless you actually share what and how you are doing thing but continue to simply state abstract problems it is no possible to assist you - details on using Time Machine are here -- http://support.apple.com/kb/HT1427?viewlocale=en_US&locale=en_US -- and -- http://pondini.org/TM/FAQ.html ---
I also lost my Idvd file, only have broken chain showing.
This would be better addressed in the iDVD forum - but again unlesss yu share detailed information no one can assist
LN -
I had to format my computers hard drive. Now the iTunes thinks my iPOD is sync'd with another computer. How do I get re-sync the iPOD and computer and get my songs on the iPOD back in to the iTunes library. Thanks!
Can't tell you exactly, as it can be used to facilitate piracy and Apple blocks this sort of thing from occuring (except for itunes purchased music)
But you can find out what your looking for at iLounge, i'd suggest that method for "mixed" music from different sources, that way you get it all back.
Next time, hit the iTunes menu and backup your library to disks, only takes a few minutes and a few DVD-R's.
Good Luck
Maybe you are looking for
-
I have a client who has been using Now to Date on her Mac. That program is now obscure and she is looking for software that is extremely similar. She has tried Outlook for Mac and it is too labor-intensive for her. She wants a professional look, a
-
How do I edit out the previous email addresses from the pop up list of address in Apple Mail?
Whenever someone sends me a new email address, I go to address book and edit the page. The problem is that whenever I go to send an email and start to type the address in, the drop down menu lists possible entries as I type, and it still keeps the ol
-
Why can't I install apps on my ipad? password there is a note that says sign in requreid
iPad cannot install apps
-
I can't burn a dvd because I get a message that says "The Build Location folder contains a HVDVD_TS folder(HD DVD content). You must remove the HVDVD_TS folder from the Build Location in order to proceed with Build/Format of a Standard DVD project."
-
Can't rename file under Subversion control.
CS5 - Unless I'm missing something you can't rename a file (using dreamweaver to do so) and have it maintain it's connection to subversion. For example, if I rename a file using Dreamweaver, edit it, then go to "Commit" it, I get an error "File is no