Need help pulling up history on specific date
i am trying to pull up history for a certain day in april..in the drop down menu april is not an option..today, last 7 days, last month or longer than 6 months..how can i pull up APRIL???
You need to scroll down through the history until you arrive there or try to formulate a query to select that date.
*https://developer.mozilla.org/en/Places_query_URIs
You can also use the SQLite Manager extension to create list
* SQLite Manager: https://addons.mozilla.org/firefox/addon/sqlite-manager/
# Open Profile Directory -> places.sqlite -> Go
# Hit the Execute SQL tab
# Use a Select like this:
<pre><nowiki>SELECT datetime(moz_historyvisits.visit_date/1000000,'unixepoch'), moz_places.url, moz_places.title
FROM moz_places, moz_historyvisits
WHERE moz_places.id = moz_historyvisits.place_id AND visit_date BETWEEN strftime('%s','2011-04-01')*1000000 AND strftime('%s','2011-04-30')*1000000
</nowiki></pre>
That query shows all history entries from April<br />
The date and time is saved in 64 bit EPOCH format in micro seconds.
* http://en.wikipedia.org/wiki/Unix_time
..........<br />
*http://www.sqlite.org/lang.html
*http://www.sqlite.org/lang_select.html
*http://www.sqlite.org/lang_select.html#fromclause
*http://www.sqlite.org/lang_select.html#whereclause
*http://www.sqlite.org/lang_expr.html#between
Similar Messages
-
Need help with representing 2 bits of data in a column
I Need help representing only 2 bits of data in a column in order to save space.
Is that possible?CommitMan wrote:
I Need help representing only 2 bits of data in a column in order to save space.
Is that possible?Yes - using Assembler....
If you need to count bits to save space, then you must be on 70's, or early 80's, hardware. So using Assembler should not be a problem. Let me guess.. a 8051 microcontroller from the 1980?
Here's what the 8051 code and memory optimisation manual says:
>
The simplest and best way to get dramatic improvements
in efficiency is to look for all variables that will have only
binary values (0 and not 0), and define them as type 'bit‘:
bit myVar;With bit variables, the full set of 8051 bit-level assembler
instructions can be used to generate very fast and
compact code. For example, the following C code:
myVar = ~myVar;
if (!myVar)
}Generates only two lines of assembler:
B200 CPL myVar
200006 JB myvar,?C0002This example uses only 5 flash bytes and 8 CPU cycles.
When you use bit variables, you can implement a
nontrivial line of C code with just one assembler
instruction.
>
<i>PS. Yes, the above is really from a manual for a real 80s microcontroller. And yes, I'm poking fun at your question as saving bits were a problem in the 80s and prior. It should not be a problem in the 21st century information system and database.</i> -
Need help pulling data from an outside file into my array. Please help =)
Hi,
I need help adapting my array to read the interest rates from an outside file. Here is my code and the outside file I wrote. Please help. Oh, the array in question is on line 259, inside of my calculation() method.
Thanks...
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
import java.text.NumberFormat;
import java.text.DecimalFormat;
import java.io.*;
import javax.swing.JOptionPane;
public class Workshop5 extends JFrame implements ActionListener
//declare gui components
//declare labels
JPanel contentPane = new JPanel();
JPanel graphPane = new JPanel();
JLabel instructionLabel = new JLabel();
JLabel amountLabel = new JLabel();
JLabel orLabel = new JLabel();
JLabel comboBoxLabel = new JLabel();
JLabel termLabel = new JLabel();
JLabel rateLabel = new JLabel();
JLabel calcLabel = new JLabel();
JLabel paymentLabel = new JLabel();
JLabel tableLabel = new JLabel();
//declare font object
Font labelFont = new Font("Tahoma", Font.PLAIN, 16);
//declare text fields
JTextField amountField = new JTextField(20);
JTextField termField = new JTextField(20);
JTextField rateField = new JTextField(20);
JTextField paymentField= new JTextField(20);
//declare combo box for loan selection
JComboBox comboBox = new JComboBox();
//declare button group and radio buttons
ButtonGroup buttonGroup = new ButtonGroup();
JRadioButton enterRadioButton = new JRadioButton("Enter amount, term, & rate", true);
JRadioButton selectRadioButton = new JRadioButton("Select a preset term/rate loan", false);
//declare button objects
JButton clearButton = new JButton();
JButton calcButton = new JButton();
JButton quitButton = new JButton();
//declare text area for amortization
JTextArea amortTextArea = new JTextArea();
JTextArea testTextArea = new JTextArea();
//declare scroll bar for amortization table
JScrollPane scrollPane = new JScrollPane(amortTextArea,ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
public Workshop5()
instructionLabel.setText("Choose one of the following payment calculation options:");
instructionLabel.setFont(new Font("Tahoma",Font.PLAIN,16));
//adds both buttons to button group
buttonGroup.add(enterRadioButton);
buttonGroup.add(selectRadioButton);
enterRadioButton.setFont(labelFont);
enterRadioButton.setBackground(Color.WHITE);
enterRadioButton.setContentAreaFilled(false);
enterRadioButton.addActionListener(this); //adds action listener to enter radio button
orLabel.setText("OR");
orLabel.setFont(new Font("Tahoma",Font.BOLD,18));
selectRadioButton.setFont(labelFont);
selectRadioButton.setBackground(Color.WHITE);
selectRadioButton.setContentAreaFilled(false);
selectRadioButton.addActionListener(this); //adds action listener to select radio button
amountLabel.setText("Enter mortgage amount");
amountLabel.setFont(new Font("Tahoma", Font.PLAIN,16));
amountField.requestFocusInWindow();
termLabel.setText("Enter term length in years:");
termLabel.setFont(new Font("Tahoma", Font.PLAIN,14));
rateLabel.setText("Enter interest rate:");
rateLabel.setFont(new Font("Tahoma", Font.PLAIN,14));
comboBoxLabel.setText("Select a loan:");
comboBoxLabel.setFont(new Font("Tahoma", Font.PLAIN,14));
comboBox.setBackground(new Color(255,255,255));
comboBox.setFont(new Font("Tahoma", Font.PLAIN, 14));
comboBox.setEnabled(false);
ComboBox();
calcLabel.setText("Press Calculate button to determine monthly payment.");
calcLabel.setFont(new Font("Tahoma", Font.PLAIN, 16));
calcButton.setText("Calculate");
calcButton.setFont(new Font("Tahoma", Font.BOLD, 14));
calcButton.addActionListener(this);
//define monthly payment label
paymentLabel.setText("Monthly payment:");
paymentLabel.setFont(new Font("Tahoma", Font.PLAIN, 16));
//define monthly payment text field
paymentField.setFont(new Font("Tahoma", Font.BOLD,16));
paymentField.setBackground(new Color(255,255,255));
paymentField.setEditable(false);
//define clear button
clearButton.setText("Clear");
clearButton.setFont(new Font("Tahoma", Font.BOLD,14));
clearButton.addActionListener(this);
//define quit button
quitButton.setText("Quit");
quitButton.setFont(new Font("Tahoma", Font.BOLD,14));
quitButton.addActionListener(this);
tableLabel.setText("Amoritization Table");
tableLabel.setFont(new Font("Tahoma", Font.BOLD, 16));
graphPane.setBackground(Color.WHITE);
//add components to content
getContentPane().add(contentPane);
contentPane.setLayout(null);
addComponent(contentPane, instructionLabel, 80,10,450,26);
addComponent(contentPane, enterRadioButton, 30,40,220,30);
addComponent(contentPane, orLabel, 280,40,100,30);
addComponent(contentPane, selectRadioButton, 335,40,350,30);
addComponent(contentPane, amountLabel, 100,80,220,26);
addComponent(contentPane, amountField, 300,80,150,26);
addComponent(contentPane, termLabel, 15,125,200,30);
addComponent(contentPane, termField, 195,125,125,30);
addComponent(contentPane, rateLabel, 62,160,200,30);
addComponent(contentPane, rateField, 195,165,125,30);
addComponent(contentPane, comboBoxLabel, 400,125,200,26);
addComponent(contentPane, comboBox, 400,155,150,30);
addComponent(contentPane, calcLabel, 100,200,400,30);
addComponent(contentPane, calcButton, 250,240,100,30);
addComponent(contentPane, paymentLabel, 150,285,200,30);
addComponent(contentPane, paymentField, 300,285,100,30);
addComponent(contentPane, clearButton, 100,330,100,30);
addComponent(contentPane, quitButton, 400,330,100,30);
addComponent(contentPane, tableLabel, 200,370,300,26);
addComponent(contentPane, scrollPane, 10,400,450,360);
addComponent(contentPane, graphPane, 475,400,305,360);
//add window listener to close window when user presses X
addWindowListener(new WindowAdapter()
public void windowClosing(WindowEvent e)
System.exit(0);
pack();
//method to add components
private void addComponent(Container container, Component c, int x, int y, int width, int height)
c.setBounds(x, y, width, height);
container.add(c);
//action performed method
public void actionPerformed(ActionEvent event)
Object source = event.getSource();
if (source == calcButton)
Calculate();
if (source == clearButton)
Clear();
if (source == quitButton)
Exit();
//defines active area based on user selection of mortgage calculation method
//if user chooses to enter the mortgage manually, combo box fields are inactive
if (source == enterRadioButton)
comboBox.setEnabled(false);
termField.setEnabled(true);
termField.setEditable(true);
rateField.setEnabled(true);
rateField.setEditable(true);
amountField.setText("");
amountField.requestFocusInWindow();
termField.setText("");
rateField.setText("");
paymentField.setText("");
amortTextArea.setText("");
//if user chooses to select from a preset mortgage, rate and term fields are inactive
if (source == selectRadioButton)
comboBox.setEnabled(true);
termField.setEnabled(false);
termField.setEditable(false);
rateField.setEnabled(false);
rateField.setEditable(false);
amountField.setText("");
amountField.requestFocusInWindow();
termField.setText("");
rateField.setText("");
paymentField.setText("");
amortTextArea.setText("");
}//end of action performed method
//combo box method
public void ComboBox()
String[] LoanArray = {" 7 years at 5.35 %", " 15 years at 5.50 %", " 30 years at 5.75 %"};
for (int i = 0; i < LoanArray.length; i++)
comboBox.addItem(LoanArray);
}//end combo box method
//calculation method
void Calculate()
//resets fields
paymentField.setText("");
amortTextArea.setText("");
//calculation variables
NumberFormat currency = NumberFormat.getCurrencyInstance();
int [] termArray = {7, 15, 30}; //array of years
double [] yearlyInterestArray = {5.35, 5.5, 5.75}; //array of interest
int totalMonths = 0; //total months
double Loan = 0.0; //amount of loan
double MonthlyInterest = 0.0; //monthly interest rate
double Payment = 0.0; //calculate payment
double monthlyPayment = 0.0; //calculate monthly payment
double Interest = 0.0; //variable for Interest Array input
int Term = 0; //variable for Term Array input
double NewMonthlyInterest = 0.0; //new interest amount
double NewLoan = 0.0; //new loan amount
double Reduction = 0.0; //principle reduction
//validate input
try
Loan = Double.parseDouble(amountField.getText());
catch (NumberFormatException e)
JOptionPane.showMessageDialog(null,"Invalid Entry. Please enter valid loan amount.", "Error", JOptionPane.WARNING_MESSAGE);
//resets input fields after error message
amountField.setText("");
amountField.requestFocusInWindow();
//if select button is chosen
if (selectRadioButton.isSelected())
int index = comboBox.getSelectedIndex();
Term = termArray[index];
Interest = yearlyInterestArray[index];
//if user chooses to enter mortgage information
else
if (enterRadioButton.isSelected())
//validates input
try
Term = Integer.parseInt(termField.getText());
catch (NumberFormatException e)
JOptionPane.showMessageDialog(null,"Invalid entry. Please enter valid term length in years.", "Error",JOptionPane.WARNING_MESSAGE);
//clears fields after error message
termField.setText("");
termField.requestFocusInWindow();
try
Interest = Double.parseDouble(rateField.getText());
catch (NumberFormatException e)
JOptionPane.showMessageDialog(null,"Invalid entry. Please enter valid rate (without percent symbol).","Error",JOptionPane.WARNING_MESSAGE);
//clears fields after error message
rateField.setText("");
rateField.requestFocusInWindow();
//perform calculations
if (Loan > 0)
Loan = Double.parseDouble(amountField.getText());
MonthlyInterest = (Interest / 12)/100;
totalMonths = Term * 12;
monthlyPayment = Loan * MonthlyInterest *(Math.pow((1 + MonthlyInterest), totalMonths)/(Math.pow((1 + MonthlyInterest), totalMonths)-1));
paymentField.setText("" + currency.format(monthlyPayment));
//send information to amortization text area
amortTextArea.append("Number\t");
amortTextArea.append(" Amount\t");
amortTextArea.append("Interest\t");
amortTextArea.append("Principle\t");
amortTextArea.append("Balance\n");
NewLoan = Loan;
for (int i = 1; i <= totalMonths; i++)
NewMonthlyInterest = MonthlyInterest * NewLoan;
Reduction = monthlyPayment - NewMonthlyInterest;
NewLoan = NewLoan - Reduction;
amortTextArea.append(" " + i +"\t");
amortTextArea.append(" " + currency.format(monthlyPayment) + "\t");
amortTextArea.append(" " + currency.format(NewMonthlyInterest)+ "\t");
amortTextArea.append(" " + currency.format(Reduction) + "\t");
amortTextArea.append(" " + currency.format(NewLoan) + "\n");
//resets fields if loan amount is less than zero
if((Loan <= 0 || Term <= 0 || Interest <= 0))
paymentField.setText("");
amortTextArea.setText("");
}//end calcualtion method
//clear method
void Clear()
amountField.setText("");
amountField.requestFocusInWindow();
termField.setText("");
rateField.setText("");
paymentField.setText("");
amortTextArea.setText("");
}//end of clear method
//main method
public static void main(String args[])
Workshop5 f = new Workshop5();
f.setTitle("Carol's Mortgage Calculator");
f.setBounds(200,100,800,800);
f.setResizable(false);
f.setVisible(true);
}//end of main method
//exit method
void Exit()
System.exit(0);
}//end of exit method
}//program end
My data file is called: "InterestData.dat" and only contains the following text:
5.35, 5.5, 5.75Ok, now I am getting this error message:
cannot resolve symbol method lenght()
Please help me out here, this is due tomorrow and I've been killing myself on it...
attaching program with revised code included, see beginning of calculation method line 250:
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.* ;
import java.text.NumberFormat;
import java.text.DecimalFormat;
import java.io.*;
import javax.swing.JOptionPane;
public class Workshop5 extends JFrame implements ActionListener
//declare gui components
//declare labels
JPanel contentPane = new JPanel();
JPanel graphPane = new JPanel();
JLabel instructionLabel = new JLabel();
JLabel amountLabel = new JLabel();
JLabel orLabel = new JLabel();
JLabel comboBoxLabel = new JLabel();
JLabel termLabel = new JLabel();
JLabel rateLabel = new JLabel();
JLabel calcLabel = new JLabel();
JLabel paymentLabel = new JLabel();
JLabel tableLabel = new JLabel();
//declare font object
Font labelFont = new Font("Tahoma", Font.PLAIN, 16);
//declare text fields
JTextField amountField = new JTextField(20);
JTextField termField = new JTextField(20);
JTextField rateField = new JTextField(20);
JTextField paymentField= new JTextField(20);
//declare combo box for loan selection
JComboBox comboBox = new JComboBox();
//declare button group and radio buttons
ButtonGroup buttonGroup = new ButtonGroup();
JRadioButton enterRadioButton = new JRadioButton("Enter amount, term, & rate", true);
JRadioButton selectRadioButton = new JRadioButton("Select a preset term/rate loan", false);
//declare button objects
JButton clearButton = new JButton();
JButton calcButton = new JButton();
JButton quitButton = new JButton();
//declare text area for amortization
JTextArea amortTextArea = new JTextArea();
JTextArea testTextArea = new JTextArea();
//declare scroll bar for amortization table
JScrollPane scrollPane = new JScrollPane(amortTextArea, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
public Workshop5()
instructionLabel.setText("Choose one of the following payment calculation options:");
instructionLabel.setFont(new Font("Tahoma",Font.PLAIN,16));
//adds both buttons to button group
buttonGroup.add(enterRadioButton);
buttonGroup.add (selectRadioButton);
enterRadioButton.setFont(labelFont);
enterRadioButton.setBackground(Color.WHITE);
enterRadioButton.setContentAreaFilled(false);
enterRadioButton.addActionListener(this); //adds action listener to enter radio button
orLabel.setText("OR");
orLabel.setFont(new Font("Tahoma",Font.BOLD,18));
selectRadioButton.setFont(labelFont);
selectRadioButton.setBackground(Color.WHITE);
selectRadioButton.setContentAreaFilled(false);
selectRadioButton.addActionListener (this); //adds action listener to select radio button
amountLabel.setText("Enter mortgage amount");
amountLabel.setFont(new Font("Tahoma", Font.PLAIN,16));
amountField.requestFocusInWindow();
termLabel.setText("Enter term length in years:");
termLabel.setFont(new Font("Tahoma", Font.PLAIN,14));
rateLabel.setText("Enter interest rate:");
rateLabel.setFont(new Font("Tahoma", Font.PLAIN,14));
comboBoxLabel.setText("Select a loan:");
comboBoxLabel.setFont(new Font("Tahoma", Font.PLAIN,14));
comboBox.setBackground(new Color(255,255,255));
comboBox.setFont(new Font("Tahoma", Font.PLAIN, 14));
comboBox.setEnabled(false);
ComboBox();
calcLabel.setText("Press Calculate button to determine monthly payment.");
calcLabel.setFont(new Font("Tahoma", Font.PLAIN, 16));
calcButton.setText("Calculate");
calcButton.setFont(new Font("Tahoma", Font.BOLD, 14));
calcButton.setBackground(new Color(202,255,112));
calcButton.addActionListener(this);
//define monthly payment label
paymentLabel.setText("Monthly payment:");
paymentLabel.setFont(new Font("Tahoma", Font.PLAIN, 16));
//define monthly payment text field
paymentField.setFont (new Font("Tahoma", Font.BOLD,16));
paymentField.setBackground(new Color(255,255,255));
paymentField.setEditable(false);
//define clear button
clearButton.setText("Clear");
clearButton.setFont(new Font("Tahoma", Font.BOLD,14));
clearButton.setBackground(new Color(202,255,112));
clearButton.addActionListener(this);
//define quit button
quitButton.setText("Quit");
quitButton.setFont(new Font("Tahoma", Font.BOLD,14));
quitButton.setBackground(new Color(202,255,112));
quitButton.addActionListener(this);
//define label for amortization table
tableLabel.setText ("Amoritization Table");
tableLabel.setFont(new Font("Tahoma", Font.BOLD, 16));
graphPane.setBackground(Color.WHITE);
//add components to content
getContentPane().add(contentPane);
contentPane.setLayout(null);
addComponent(contentPane, instructionLabel, 80,10,450,26);
addComponent(contentPane, enterRadioButton, 30,40,220,30);
addComponent(contentPane, orLabel, 280,40,100,30);
addComponent(contentPane, selectRadioButton, 335,40,350,30);
addComponent(contentPane, amountLabel, 100,80,220,26);
addComponent(contentPane, amountField, 300,80,150,26);
addComponent(contentPane, termLabel, 15,125,200,30);
addComponent(contentPane, termField, 195,125,125,30);
addComponent(contentPane, rateLabel, 62,160,200,30);
addComponent(contentPane, rateField, 195,165,125,30);
addComponent(contentPane, comboBoxLabel, 400,125,200,26);
addComponent(contentPane, comboBox, 400,155,150,30);
addComponent(contentPane, calcLabel, 100,200,400,30);
addComponent(contentPane, calcButton, 250,240,100,30);
addComponent(contentPane, paymentLabel, 150,285,200,30);
addComponent(contentPane, paymentField, 300,285,100,30);
addComponent(contentPane, clearButton, 100,330,100,30);
addComponent(contentPane, quitButton, 400,330,100,30);
addComponent(contentPane, tableLabel, 200,370,300,26);
addComponent(contentPane, scrollPane, 10,400,450,360);
addComponent(contentPane, graphPane, 475,400,305,360);
//add window listener to close window when user presses X
addWindowListener(new WindowAdapter()
public void windowClosing(WindowEvent e)
System.exit(0);
pack();
//method to add components
private void addComponent(Container container, Component c, int x, int y, int width, int height)
c.setBounds(x, y, width, height);
container.add(c);
//action performed method
public void actionPerformed(ActionEvent event)
Object source = event.getSource();
if (source == calcButton)
Calculate();
if (source == clearButton)
Clear();
if (source == quitButton)
Exit();
//defines active area based on user selection of mortgage calculation method
//if user chooses to enter the mortgage manually, combo box fields are inactive
if (source == enterRadioButton)
comboBox.setEnabled(false);
termField.setEnabled(true);
termField.setEditable(true);
rateField.setEnabled(true);
rateField.setEditable(true);
amountField.setText ("");
amountField.requestFocusInWindow();
termField.setText("");
rateField.setText("");
paymentField.setText ("");
amortTextArea.setText("");
//if user chooses to select from a preset mortgage, rate and term fields are inactive
if (source == selectRadioButton)
comboBox.setEnabled(true);
termField.setEnabled(false);
termField.setEditable(false);
rateField.setEnabled (false);
rateField.setEditable(false);
amountField.setText("");
amountField.requestFocusInWindow();
termField.setText ("");
rateField.setText("");
paymentField.setText("");
amortTextArea.setText("");
}//end of action performed method
//combo box method
public void ComboBox()
String[] LoanArray = {" 7 years at 5.35 %", " 15 years at 5.50 %", " 30 years at 5.75 %"};
for (int i = 0; i < LoanArray.length; i++)
comboBox.addItem(LoanArray);
}//end combo box method
//calculation method
void Calculate()
//resets fields
paymentField.setText("");
amortTextArea.setText("");
//calculation variables
NumberFormat currency = NumberFormat.getCurrencyInstance();
//declare input stream object
InputStream istream;
//create a file object to refer to the outside file
File interestData = new File("InterestFile.dat");
//assign instream to the new file object
istream = new FileInputStream(interestData);
try
StringBuffer sb = new StringBuffer();
BufferedReader in = new BufferedReader(new FileReader(interestData));
String line = "";
while((line = in.readLine()) != null)
sb.append(line);
in.close();
String fileData = sb.toString();
String[] splitData = fileData.split(", ");
double [] yearlyInterestArray = new double[splitData.length()];
for(int j = 0; j < splitData.length(); j++)
yearlyInterestArray[j] = new Double(splitData[j]).doubleValue();
catch (IOException e)
JOptionPane.showMessageDialog(null, "File does not exist." + e.getMessage());
int [] termArray = {7, 15, 30}; //array of years
double [] yearlyInterestArray = { 5.35, 5.5, 5.75}; //array of interest
int totalMonths = 0; //total months
double Loan = 0.0; //amount of loan
double MonthlyInterest = 0.0; //monthly interest rate
double Payment = 0.0; //calculate payment
double monthlyPayment = 0.0; //calculate monthly payment
double Interest = 0.0; //variable for Interest Array input
int Term = 0; //variable for Term Array input
double NewMonthlyInterest = 0.0; //new interest amount
double NewLoan = 0.0; //new loan amount
double Reduction = 0.0; //principle reduction
//validate input
try
Loan = Double.parseDouble(amountField.getText());
catch (NumberFormatException e)
JOptionPane.showMessageDialog(null,"Invalid Entry. Please enter valid loan amount.", "Error", JOptionPane.WARNING_MESSAGE);
//resets input fields after error message
amountField.setText("");
amountField.requestFocusInWindow ();
//if select button is chosen
if (selectRadioButton.isSelected())
int index = comboBox.getSelectedIndex ();
Term = termArray[index];
Interest = yearlyInterestArray[index];
//if user chooses to enter mortgage information
else
if (enterRadioButton.isSelected())
//validates input
try
Term = Integer.parseInt(termField.getText());
catch (NumberFormatException e)
JOptionPane.showMessageDialog(null,"Invalid entry. Please enter valid term length in years.", "Error",JOptionPane.WARNING_MESSAGE);
//clears fields after error message
termField.setText("");
termField.requestFocusInWindow();
try
Interest = Double.parseDouble(rateField.getText());
catch (NumberFormatException e)
JOptionPane.showMessageDialog(null,"Invalid entry. Please enter valid rate (without percent symbol).","Error",JOptionPane.WARNING_MESSAGE);
//clears fields after error message
rateField.setText("");
rateField.requestFocusInWindow();
//perform calculations
if (Loan > 0)
Loan = Double.parseDouble(amountField.getText ());
MonthlyInterest = (Interest / 12)/100;
totalMonths = Term * 12;
monthlyPayment = Loan * MonthlyInterest *(Math.pow ((1 + MonthlyInterest), totalMonths)/(Math.pow((1 + MonthlyInterest), totalMonths)-1));
paymentField.setText("" + currency.format(monthlyPayment));
//send information to amortization text area
amortTextArea.append("Number\t");
amortTextArea.append(" Amount\t");
amortTextArea.append("Interest\t");
amortTextArea.append("Principle\t");
amortTextArea.append("Balance\n");
NewLoan = Loan;
for (int i = 1; i <= totalMonths; i++)
NewMonthlyInterest = MonthlyInterest * NewLoan;
Reduction = monthlyPayment - NewMonthlyInterest;
NewLoan = NewLoan - Reduction;
amortTextArea.append(" " + i +"\t");
amortTextArea.append (" " + currency.format(monthlyPayment) + "\t");
amortTextArea.append(" " + currency.format(NewMonthlyInterest)+ "\t");
amortTextArea.append(" " + currency.format(Reduction) + "\t");
amortTextArea.append(" " + currency.format(NewLoan) + "\n");
//resets fields if loan amount is less than zero
if((Loan <= 0 || Term <= 0 || Interest <= 0))
paymentField.setText("");
amortTextArea.setText("");
}//end calcualtion method
//clear method
void Clear()
amountField.setText("");
amountField.requestFocusInWindow();
termField.setText("");
rateField.setText("");
paymentField.setText("");
amortTextArea.setText("");
}//end of clear method
//main method
public static void main(String args[])
Workshop5 f = new Workshop5();
f.setTitle("Carol's Mortgage Calculator");
f.setBounds(200,100,800,800);
f.setResizable(false);
f.setVisible(true);
}//end of main method
//exit method
void Exit()
System.exit(0);
}//end of exit method
}//program end -
Need Help Urgently - Want to Load Time Data Automatically into Oracle HRMS
Hi All,
I am on my 1st Oracle HRMS project and I need urgent help on HOW TO load Time (IN/OUT) Data from a MS Access database which is populated by a Biometric Hand Geometry System.
And we need to do it in real time as the data inserted in the MS Access Database we need to pull that into Oracle HRMS for Payroll purposes.
If somebody can help me in this I'll greatly appreciate that.
Thanks, AGAIN IT IS VERY URGENT
ZeeZee,
Let's go back to your core requirement "load Time (IN/OUT) Data from a MS Access database which is populated by a Biometric Hand Geometry System".
Questions:
1. Is this time data to be used to pay a person through Oracle Payroll?
2. What legislation (country) is this for?
3. Are you using Oracle Time and Labor (OTL) as the front-end or do you intend to enter the data directly into Oracle Payroll?
See the following OTL documents:
MetaLink Note 369022.1 - How Can Hours Worked Be Imported into OTL From Third Party System?
MetaLink Note 223987.1 - Oracle OTL HXC TimeStore Deposit API
MetaLink Note 283593.1 - Formatting an Exported Timecard Template using Microsoft Excel
Regards,
Greg -
I need help to convert a string to date and time
Good aft,
1.How can i get a date from the user input thro' Frames?
2.How to parse it to the date object(I need to include java.util.Date but for the database i need to include java.sql.*,if i do so, i have error as
found:java.util.Date
Required:java.sql.Date)
3.How to insert into the database
The same i need help to insert time into database?
I need solution and explanation...
Reply me immediately...
If u send me the code, its better to me.Hello,
The best way is to use the HEX to decimal coversion VI in the string pallette. Then, write this decimal directly to your chart. If you are doing it a point at a time put it into a while loop.
Doug -
Need help using LabVIEW 7.1 and data socket to transfer images
I need help transferring images across a company network using: LV 7.1, IMAQ 3.0 and a PCI 1407 image aquisition card. I am trying to use datasocket to transfer video image across a company network. I have attached sample vis. Thanks in advance for your help.
I. Cyr
Attachments:
Vibration Chamber Vision_Cyr.llb 129 KBHello –
Something that you need to consider is the fact that when you are sending an image over Data Socket, it is not really the image what is being transferred but a pointer to the image. Please take a look into this Knowledgebase.
Also, you might find this Example Program useful.
Hope this helps.
S Vences
Applications Engineer
National Instruments -
Need help pulling correct data from MAS90
I am trying to pull data from payroll and am not getting the correct amounts. Part of the information is for the current pay period and the other information is for year to date data. The current information is coming from one file and the year to date from another file. I can get the correct information to pull if I insert only the current period fields or year to date fields, but when I have both in the report, I don't get the correct amounts to pull. I asssume this has to do with the linking of the fields. I have played with this and can't get it to work.
Thank you,
DebMAS90 is an OEM partner of ours. For database connectivity issues please contact them. Once connected if you have issues designing reports then we can help.
-
Need Help Pulling Data from Oracle Table (Newby)
Let me start of by saying I'm very new to Java so the code may be messy/poorly coded (I'm trying!). However, I've come a long way already and the code is almost working (it compiles and returns what I expect in one case). What I'm trying to do is prompt the user to enter a type, then a key. I use that type to determine the SQL statement to use then I use the key as part of the SQL statement.
If I enter 'custnum' as the type, then a string as my key, it finds the record fine.
If I any of my other valid types (lname, address or phone) and then enter my key, the result set is empty. I've verified that there are matching records for the type/key I'm entering.
I've tried stepping it through the debugger and looking at various variables along the way both with the working scenario and the not-working scenario, but I can't find anything. I'm sure it's a simple coding mistake, but I don't really know how to track it down.
Any ideas on what's going wrong would be greatly appreciated. Thanks!
//Start code
import java.sql.*;
import java.util.Scanner;
public class AccessCustomerTable
private static final String DEFAULT_DRIVER = "oracle.jdbc.driver.OracleDriver";
private static final String DEFAULT_URL = "jdbc:oracle:thin:@hostname.com:1521:orap1";
private static final String DEFAULT_USERNAME = "username";
private static final String DEFAULT_PASSWORD = "password";
//Set the SQL statements
private static final String SQLCUSTOMER_CUSTNUM =
"select CUSTNUM,CUST_LNAME,CUST_FNAME,CUST_PHONE,EMAIL,STAT_LVL,HH_NUM " +
"from EME.CUSTOMER " +
"where CUSTNUM=?";
private static final String SQLCUSTOMER_CUST_LNAME =
"select CUSTNUM,CUST_LNAME,CUST_FNAME,CUST_PHONE,EMAIL,STAT_LVL,HH_NUM " +
"from EME.CUSTOMER " +
"where CUST_LNAME=?";
private static final String SQLCUSTOMER_CUST_PHONE =
"select CUSTNUM,CUST_LNAME,CUST_FNAME,CUST_PHONE,EMAIL,STAT_LVL,HH_NUM " +
"from EME.CUSTOMER " +
"where CUST_PHONE=?";
private static final String SQLCUSTOMER_EMAIL =
"select CUSTNUM,CUST_LNAME,CUST_FNAME,CUST_PHONE,EMAIL,STAT_LVL,HH_NUM " +
"from EME.CUSTOMER " +
"where EMAIL=?";
private static final String SQLDETAIL =
"select TRANS_DATE,STORENUM,TERMINAL,TRANSID,OPERATOR,SALES_TOT," +
"AMOUNT_SPENT,AUTO_CPNS,PTS_EARNED,PTS_REDEEMED,RDMT_CPNS,ADD_CPNS," +
"USED_CPNS,OFFLINE_ALT_ID,RECON_IND " +
"from EME.CUSTOMERDETAIL " +
"where CUSTNUM=?";
private static final String SQLHOUSEHOLD =
"select PGM_PTS,PERIOD_PTS,PGM_RDM,PERIOD_RDM,SALES_TOT,AUTO_CPNS," +
"CARD_UCNT,MESSAGE,DISC_GRP,PT_MULTP,USERFEAT1,USERFEAT2,USERFEAT3,TARG_CPNS " +
"from EME.HOUSEHOLD " +
"where HH_NUM=?";
public static void main(String[] args)
Connection conn = null;
PreparedStatement stmt = null;
ResultSet rset = null;
//declare all variables
String custNum = "";
String custLNm = "";
String transDt = "";
String storeNum = "";
String pgmPtsEarned = "";
String periodPtsEarned = "";
try {
//********** Get Customer Data **********
householdNum = "";
Class.forName(DEFAULT_DRIVER);
conn = DriverManager.getConnection(DEFAULT_URL,DEFAULT_USERNAME,DEFAULT_PASSWORD);
String lookupType = getUserInput("Lookup Type");
if (lookupType.toUpperCase().equals("CUSTNUM"))
stmt=conn.prepareStatement(SQLCUSTOMER_CUSTNUM);
else if (lookupType.toUpperCase().equals("LNAME"))
stmt=conn.prepareStatement(SQLCUSTOMER_CUST_LNAME);
else if (lookupType.toUpperCase().equals("PHONE"))
stmt=conn.prepareStatement(SQLCUSTOMER_CUST_PHONE);
else if (lookupType.toUpperCase().equals("ADDRESS"))
stmt=conn.prepareStatement(SQLCUSTOMER_EMAIL);
else
//stop execution with message
System.out.println("Invalid lookup type entered. Process stopping");
System.exit(0);
String lookupKey = getUserInput("Lookup Key");
System.out.println("Lookup Key is " + lookupKey);
stmt.setString(1,lookupKey);
rset = stmt.executeQuery();
//what if rset returns no records?
boolean empty=true;
while (rset.next())
empty=false;
custNum = rset.getString(1);
custLNm = rset.getString(2);
if (empty)
System.out.println("No records found for " + lookupKey);
System.exit(0);
//********** Get Detail Data **********
stmt=conn.prepareStatement(SQLDETAIL);
//stmt.setString(1,customerId);
stmt.setString(1,custNum);
rset = stmt.executeQuery();
empty = true;
while (rset.next())
empty = false;
transDt = rset.getString(1);
storeNum = rset.getString(2);
if (empty)
System.out.println("No detail records found for customer # " + custNum);
System.exit(0);
//********** Get Household Data **********
stmt=conn.prepareStatement(SQLHOUSEHOLD);
stmt.setString(1,householdNum);
rset = stmt.executeQuery();
empty = true;
while (rset.next())
empty = false;
pgmPtsEarned = rset.getString(1);
periodPtsEarned = rset.getString(2);
if (empty)
System.out.println("No household records found for " + householdNum);
System.exit(0);
catch(Exception x)
System.out.println(x.getMessage());
x.printStackTrace();
finally
close(rset);
close(stmt);
close(conn);
private static void close(Connection conn)
try
if (conn != null)
conn.close();
catch (SQLException e)
e.printStackTrace();
private static void close(Statement stmt)
try
if (stmt != null)
stmt.close();
catch (SQLException e)
e.printStackTrace();
private static void close(ResultSet rset)
try
if (rset != null)
rset.close();
catch (SQLException e)
e.printStackTrace();
public static String getUserInput(String getVal)
Scanner sc = new Scanner(System.in);
//for now, I'll be expecting "CustNum", "LName", "Phone", "Address"
System.out.println("Enter " + getVal + ": ");
String returnStr = sc.nextLine();
return (String) returnStr;
}You're new to Java, so you can be forgiven. You actually tried to do some good things, like close resources. Good for you.
Do yourself a favor and start trying to think in terms of objects.
Let's call that class CustomerTableGateway.
Let's write separate methods for each kind of SQL statement you have.
Get the logic out of the main method. It's almost useless there.
There's a computer science principle called DRY - Don't Repeat Yourself. When you see code being repeated, see if you can find a way to rewrite it so you only do it once.
I'd recommend that you start with a Customer class. Figure out how to map a row from your CUST table into the Customer object. Have an interface that would look like this:
public interface CustomerDao
Customer findById(String id);
List<Customer> findByLastName(String lastName);
List<Customer> findByName(String firstName, String lastName);
List<Customer> findByEmail(String email);
List<Customer> findByPhone(String phone);
}Have another interface called RowMapper:
public interface RowMapper
Object map(ResultSet rs);
}An implementation for one of those methods might look like this:
public Customer findById(String id)
Customer customer = null;
PreparedStatement stmt = null;
ResultSet rs = null;
try
stmt = this.connection.prepareStatement(FIND_CUSTOMER_BY_ID);
stmt.setString(1, id);
rs = stmt.executeQuery();
while (rs.next())
customer = (Customer)this.customerMapper.map(rs);
catch (SQLException e)
e.printStackTrace();
finally
DatabaseUtils.close(rs); // move those nice close methods into a utility class so you can reuse them.
DatabaseUtils.close(stmt);
return customer;
}You did a pretty good job. Just go further.
% -
I need help in "HOW TO EXTEND THE DATA TYPE SYSTEM"......
Hi All,
I need to add new data type like SDO_GEOMETRY in spatial Oracle.
I don't mean the User-Defined Datatype but new datatype embed in the database.
I read the Data Cartridge Developer's Guide but it has info how to use more efficiently UDT through indexes.
Anybody used the “Type System” under Databases and Extensibility Services?
It might be written in C++ or Java but I do not know how.
Any hints and help will be appreciated.
Thanks,> In Figure 1-1 Oracle Services, there is a "Type System" as Oracle Services.
The "Type System" is merely a compartmentalising the data type handling and implementation code/modules in Oracle.
This covers all types. Oracle native types, user defined types (UDTs), etc.
Saying that you want to create a new type in the "Type System" is basically saying you want to use the CREATE TYPE SQL command in Oracle.
> So, I want new_type1 and new_type2 behave like other built-in types, just the way
SDO_GEOMETRY works in Oracle Spatial Cartridge.
Not familiar with the SDO_GEOMETRY. Why do you mention this type specifically? What do you want to do similar?
> I have already done it with user-defined types. Now I need to do this way so that I can
compare and contrast in terms of speed, space...etc for part of my research.
Hmm.. I'm not sure what you are trying to compare ito of a UDT and Data Cartridge extensions. It is not one or the other. What research is this if I may ask?
Simplistically you extend the Type System with a new UDT/ADT. And there you have a new type data can be used in the SQL Engine and the PL/SQL engine. The OCI (Oracle Call Interface) supports such types via the OCI object API calls - which means this new type can also be used from Oracle clients written in Delphi, C++, Java, etc.
That new type can be a complex type. This type may need specific management code (memory management, context management, internationalisation, etc). To support this you can extend the UDT/ADT further by developing Cartridge Basic Service interfaces for the type - designing and writing management code to, for example, support specific internationalisation requirements when dealing with multibyte character sets.
You can also extend the UDT/ADT to be custom managed ito indexing, determining query optimisation, computing costs of custom methods/functions/operators on this custom data type. These extensions are done by developing Data Cartridge interfaces for the type.
Thus I cannot see what you are trying to compare. It is not one layer/interface versus another. These layers exist for all Oracle types (in the Type System). Oracle not only allows you to add to the top layer by adding/defining a new data type. It also allows you to customise (if needed) the layers below it. -
Need help with query that can look data back please help.
hi guys i have a table like such
CREATE TABLE "FGL"
"FGL_GRNT_CODE" VARCHAR2(60),
"FGL_FUND_CODE" VARCHAR2(60),
"FGL_ACCT_CODE" VARCHAR2(60),
"FGL_ORGN_CODE" VARCHAR2(60),
"FGL_PROG_CODE" VARCHAR2(60),
"FGL_GRNT_YEAR" VARCHAR2(60),
"FGL_PERIOD" VARCHAR2(60),
"FGL_BUDGET" VARCHAR2(60)
)and i have a data like such
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','11','1','400');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','10','1','100');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','1','0');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','14','200');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','10','14','100');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','10','2','100');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7470','4730','02','10','2','200');I bascially need to get the total of the budget column. however its not as simple as it sound(well atleast not for me.) the totals carry over to the new period. youll noticed the you have a period column. basically what im saying is that
fgl_grant_year 10 period 1 = for account 7600 its $100 and $100 for period 2 you see 100 dollars again this is not to be added this is the carried over balance. which remains $100.
so im trying to write a query that basically does the following.
im given a period for the sake of this example lets say period 1 i get nothing else. I have to find the greates grant year grab the amount for period 14(which is the total from the previous year) and add it to the amount of the current period. in this case period 1 grnt_year 11
so the expected outcome should be $700
240055 240055 7240 4730 02 10 14 200
240055 240055 7600 4730 02 10 14 100
240055 240055 7600 4730 02 11 1 400keep in mind that im not given a year just a period.
any help that you guys can offer would be immensely appreciated. I have been trying to get this to work for over 3 days now.
finally broke down and put together this post
Edited by: mlov83 on Sep 14, 2011 8:48 PMFrank
wondering if you can help me modify this sql statement that you provided me with .
table values have been modified a bit.
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','11','00','400');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','1','100');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','1','0');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','11','1','400');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('360055','360055','7200','4730','02','10','1','400');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('360055','360055','7600','4730','02','10','1','400');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','14','200');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7600','4730','02','10','14','100');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','14','200');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','10','2','100');
Insert into FGL (FGL_GRNT_CODE,FGL_FUND_CODE,FGL_ACCT_CODE,FGL_ORGN_CODE,FGL_PROG_CODE,FGL_GRNT_YEAR,FGL_PERIOD,FGL_BUDGET) values ('240055','240055','7240','4730','02','11','2','600');i need to take one more thing into consideration. if the greatest year has a value on period 00 i need to ignore the period 14 and the current period total would be
the current period +(current period - greatest year 00)
hope that makes sense so in other words with the new data above. if i was querying period two of grant year 11. i would end up with $800
because the greatest year is 11 it contains a period 0 with amount of $400 so my total should be
period 2 amount $ 600
period 0 amount $ 400 - period 2 amount of $600 = 200
600+200 = $800
if i query period 1 of grant 360055 i would just end up with 800 of grnt year 10.
i have tried to modify that query you supplied to me with no luck. I have tried for several day but im embarrased to say i just can get it to do what im trying to do .
can you please help me out.
Miguel -
NEED HELP IN USING ALL_TAB_COLUMNS FOR RETRIEVING DATA???
A table say T1 contains column like Emp_id,Code.
and there are several Code like C1,C2,C3.
Another table say T2 contains column like
Emp_id,C1,C2,C3.Here the value of the code field of the
T1 table is now column of the T2 table.And the amount of
each code of T1 table is equal to column value of T2
table.
Now I want to retrieve data from T2 table like
C1 200
C2 300
C3 140
I cannot retrieve data like this using all_tab_columns.
I can only getting the column_name but cannot its value.
PLEASE HELP ME...
Edited by: user630863 on Apr 8, 2009 11:37 AMemp_id | code
001 | C1
001 | C2
005 | C3
005 | C1
002 | C2
002 | C3
Table T1
emp_id | C1 | C2 | C3
001 | 10 | 15 |
002 | | 7 | 12
005 | 45 | | 94
Table T2
I have written a query
select column_name from all_tab_columns a,T1 b
where a.column_name=b.code
and table_name='T2'
OUTPUT:
C1
C2
C3
But I Need data for each employee like
001 C1 10
001 C2 15
002 C2 7
002 C3 12
005 C1 45
005 C3 94
Edited by: user630863 on Apr 8, 2009 1:28 PM -
Need help on How to delete duplicate data
Hi All
I need your help in finding the best way to delete duplicate data from a table.
Table is like
create table table1 (col1 varchar2(10), col2 varchar2(20), col3 varchar2(30));
Insert into table1 ('ABC', 'DEF','FGH');
Insert into table1 ('ABC', 'DEF','FGH');
Insert into table1 ('ABC', 'DEF','FGH');
Insert into table1 ('ABC', 'DEF','FGH');
Now I want a sql statement which will delete the duplicate rows and leaves 1 row of that data in the table. ie.in the above example delete 3 rows of duplicate data and leave a row of that data in the table. My oracle version is 8i.
Appreciate your help in advance.Either of these will work, the best approach will depend on how big the table is, and how many duplicates there are.
SQL> SELECT * FROM table1;
COL1 COL2 COL3
ABC DEF FGH
ABC DEF FGH
ABC DEF FGH
ABC DEF FGH
ABC DEF IJK
BCD EFG HIJ
BCD EFG HIJ
SQL> DELETE FROM table1 o
2 WHERE rowid <> (SELECT MAX(rowid)
3 FROM table1 i
4 WHERE o.col1 = i.col1 and
5 o.col2 = i.col2 and
6 o.col3 = i.col3);
4 rows deleted.
SQL> SELECT * FROM table1;
COL1 COL2 COL3
ABC DEF FGH
ABC DEF IJK
BCD EFG HIJ
SQL> ROLLBACK;
Rollback complete.
SQL> CREATE TABLE table1_tmp AS
2 SELECT DISTINCT * FROM table1;
Table created.
SQL> TRUNCATE TABLE table1;
Table truncated.
SQL> INSERT INTO table1
2 SELECT * FROM table1_tmp;
3 rows created.
SQL> SELECT * FROM table1;
COL1 COL2 COL3
ABC DEF FGH
ABC DEF IJK
BCD EFG HIJThere are other approaches as well (e.g. see the EXCEPTIONS INTO clause of the ALTER TABLE command), but these are the most straightforward.
HTH
John -
Need help regarding the maximum limit for data type
Hi,
this is Sravan. for my application am inserting the bulk data in XML format into a column of Database table.
the sample inserted XML data will be in format... like
'<ACC count = "10">
<Acc ac_no = "1111111111" cn_nr = "US" eflag = "Y" />
<Acc ac_no = "1111111111" cn_nr = "US" eflag = "Y" />
<Acc ac_no = "1111111111" cn_nr = "US" eflag = "Y" />
<Acc ac_no = "1111111111" cn_nr = "US" eflag = "Y" />
<Acc ac_no = "1111111111" cn_nr = "US" eflag = "Y" />
<Acc ac_no = "1111111111" cn_nr = "US" eflag = "Y" />
<Acc ac_no = "1111111111" cn_nr = "US" eflag = "Y" />
<Acc ac_no = "1111111111" cn_nr = "US" eflag = "Y" />
<Acc ac_no = "1111111111" cn_nr = "US" eflag = "Y" />
<Acc ac_no = "1111111111" cn_nr = "US" eflag = "Y" />
</ACC>'
this data in XML can have more than 1000 accounts.
now, i need to take a Parameter value from XML node and write into a file. for this i have written a procedure by looping the Nodes from XML data and building Dynamic Query like..
if nvl(v_int, 0) > 0 then
v_sql := '';
for v_count in 1..v_int
loop
if v_sql is null then
v_sql := 'select extractvalue(empdetails, ''/ACC/Acc' || v_count ||'/@ac_no'')||extractvalue(empdetails, ''/ACC/Acc' || v_count
||'/@cn_nr'')||extractvalue(empdetails, ''/ACC/Acc' || v_count ||'/@eflag'') string from sample1';
elsif v_sql is not null then
v_sql := v_sql || ' union all select extractvalue(empdetails, ''/ACC/Acc' || v_count ||'/@ac_no'')||extractvalue(empdetails, ''/ACC/Acc' || v_count
||'/@cn_nr'')||extractvalue(empdetails, ''/ACC/Acc' || v_count ||'/@eflag'') string from sample1';
end if;
end loop;
end if;
i will get this variable "v_int" from <ACC count = "10"> ACC count Attribute, here 10 is the value for v_int variable but in real time the variable value can be more than 1000.
at the time of Building Dynamic Query I make using the Variable v_SQL which is of Data Type "Long",
this variable stores dynamic query which is build at the time of executing procedure but this v_sql Variable is throughing Exception that ....
"numeric or value error Character String Buffer is Too Small"... but Long Data type will store upto 2GB..
this variable cant able to hold much data which is dynamically build.
will you please help me to resolve this issue Or will u suggest me another method to pick the data from XML column.
thanks,
sravan.user11176969 wrote:
i changed the code, now its working fine.
direct assigning the dynamic query to a Clob variable raised error.
for dynamic query building i used another variable and assigned this variable value to actual query variable.Nice! -
Need help pulling unrelated counts into a report
Post Author: tminner
CA Forum: Crystal Reports
Right now I'm using Crystal 9 to create Performance Reviews for all our employees (about 400/month) and everything is fine except I need 4 counts for tardies, warnings, absences, and suspensions. Of course these are kept in unrelated tables for example I'm counting tardies from VP_TIMESHEETCOMMENTS.comments = "Tardy-Late for Work" and absences from VP_TIMESHEETCOMMENTS.comments = "Absent".
When I create running totals for these it works fine, however when I try to count warnings from EVENTS.event = "Warning" then all my running totals give me wrong information.
What would be a better way of doing this? I'm also grouping by person ID and have the entire Performance Review in the group footer. I just need accurate counts for the last year. Please help....
TimPost Author: crimson
CA Forum: Crystal Reports
Try this:
If you are grouping on 'person ID' in your main report, group on 'person ID' in your subreport. Then from your main report, Right Click on the subreport. Click on Change Subreport Links. Set up a subreport parameter field 'person ID' and it will create a parameter field in the subreport (ex: ?Pm-person_ID) that ties it to the group value in the main report. Be sure and click on the checkbox that says "Select data in subreport based on field:" with the person ID field name right underneath it. -
Hello everyone, Need help using POI to access xslx data
Hi,
i am trying to make a simple program in OATS which will fetch data and display the output from a xlsx file.
The file name is DriverAdapter and its java script is as below. I have written a java class called ActionDriver whch performs the actions for me using the POI api. But when i instantiate ActionDriver,
it is throwing the exception referrring to POI api classes cannot be found. ClassNotFoundException : org.apache.poi.openxml4j.exceptions.InvalidOperationException;
Can someone help me out to find how can i run this through DriverAdapter. When i tried to run ActionDriver from the same project as a java application by replacing my method with main, it is running fine.
import oracle.oats.scripting.modules.basic.api.*;
import oracle.oats.scripting.modules.browser.api.*;
import oracle.oats.scripting.modules.functionalTest.api.*;
import oracle.oats.scripting.modules.utilities.api.*;
import oracle.oats.scripting.modules.utilities.api.sql.*;
import oracle.oats.scripting.modules.utilities.api.xml.*;
import oracle.oats.scripting.modules.utilities.api.file.*;
import oracle.oats.scripting.modules.webdom.api.*;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import ats.test.ActionDriver;
public class script extends IteratingVUserScript {
@ScriptService oracle.oats.scripting.modules.utilities.api.UtilitiesService utilities;
@ScriptService oracle.oats.scripting.modules.browser.api.BrowserService browser;
@ScriptService oracle.oats.scripting.modules.functionalTest.api.FunctionalTestService ft;
@ScriptService oracle.oats.scripting.modules.webdom.api.WebDomService web;
@ScriptService oracle.oats.scripting.modules.formsFT.api.FormsService forms;
private static String myData="C:/data.xlsx";
public void initialize() throws Exception {
//initializing ActionDriver
dAction = new ActionDriver();
* Add code to be executed each iteration for this virtual user.
public void run() throws Exception{
dAction.startAction(myData);
public void finish() throws Exception {
Below is the code for my ActionDriver
package ats.test;
//package sni.test.ats;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import org.apache.poi.openxml4j.exceptions.InvalidOperationException;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
public class ActionDriver
public static void main (String ar[])
//public void startAction(String myData)
boolean b = true;
try
XSSFWorkbook wb = new XSSFWorkbook("c:/data.xlsx");
//XSSFWorkbook wb = new XSSFWorkbook(myData);
XSSFSheet sheet = wb.getSheet(DataConstants.businessFlow);
ArrayList businessRule = new ArrayList();
Iterator rows = sheet.rowIterator();
String myScripts[];
while (rows.hasNext())
XSSFRow row = (XSSFRow) rows.next();
row = (XSSFRow) rows.next();
Iterator cells = row.cellIterator();
while (cells.hasNext())
XSSFCell cell = (XSSFCell) cells.next();
if (cell.getCellType()==XSSFCell.CELL_TYPE_NUMERIC )
businessRule.add(cell.getNumericCellValue());
else
businessRule.add(cell.getStringCellValue());
performAction(businessRule);
catch(Exception fife)
System.out.println("Exception Occured"+fife);
b=false;
/*catch(IOException ie)
System.out.println("Error Handling Input File"+ie);
public static void performAction(ArrayList businessRules)
Object[] businessRuleArray = businessRules.toArray();
boolean b=true;
for (int i=1; i<businessRuleArray.length;i++)
if(b)
String rule = businessRuleArray.toString();
System.out.println(rule);
else
break;[this |http://blogs.oracle.com/aamat/2009/06/load_testing_your_oracle_datab_1.html] Hi
Is that class located in the same folder as the script.java class?
If note you will need to add it on the manifest, you can look at this blogs for instructions on how to edit the manifest file.
Regards
Alex
Maybe you are looking for
-
Cannot see emails in the inbox, but can send emails out. why?
I bought the Galaxy S III about 3 months ago, and have been struggling to set up my personal email (my own domain hosted by godaddy.com). my gmail accounts sync up nicely from day 1. Today, a tech rep from Godaddy.com suggested that i turn off wi-fi
-
Strange errors on compiling in solaris 10
I was trying to compile my application on solaris 10 and i got these strange long list of errors. i tried to verify the same by just trying to compile the hello world program and got the same error messages. i am using solaris 10 machine with gcc 3.4
-
Dialling from 7960 - speed dial works, manual dial fails
Hi, i've got an issue on a dialling a particular number from 7960 phones. When i dial a speed dial setup with the number 9121000 i hit the correct route pattern and the the 9 is stripped and an external call is placed to 121000 through my gateway. if
-
DATA exchange using XML using ABAP
Client is having requirement of sharing data with Third party using XML files and this needs to be done using ABAP and changes in XML structure are highly likely in the future and structure is very complex around 100 fields corresponding to an accoun
-
I need a pdf converter that uses thai language