How do I break my codes into classes??
How do i break each tab into a class and call them inside a main program ??
Please show me how thanks.
import javax.swing.JTabbedPane;
import javax.swing.ImageIcon;
import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.JFrame;
import javax.swing.JButton;
import javax.swing.BorderFactory;
import java.awt.*;
import java.awt.event.*;
import java.awt.print.*;
import java.sql.*;
import java.io.*;
public class DatabaseApp extends JPanel {
// declare the width and height of UI
public static int WIDTH = 800;
public static int HEIGHT = 600;
// create textfield objects for user to enter the input
TextField employeeID = new TextField(15);
TextField name = new TextField(40);
TextField address = new TextField(40);
TextField suburb = new TextField(20);
TextField state = new TextField(5);
TextField pCode = new TextField(5);
TextField dob = new TextField(15);
TextField homePh = new TextField(15);
TextField workPh = new TextField(15);
TextField mobile = new TextField("0",15);
TextField eMail = new TextField(30);
TextField dbase = new TextField("employee",20);
TextField report = new TextField(15);
TextField query= new TextField(50);
TextArea displayArea = new TextArea(16,80);
TextArea helpArea = new TextArea(20,80);
public static void main (String[] args) {
JFrame frame = new JFrame ("S-League Management System");
frame.addWindowListener(new WindowAdapter(){
public void windowClosing (WindowEvent e) {
System.exit(0);
frame.getContentPane().add(new DatabaseApp(), BorderLayout.CENTER);
frame.setSize(800,600);
frame.setResizable(false);
frame.setVisible(true);
//centralise the screen
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension frameSize = frame.getSize();
frame.setLocation((screenSize.width - frameSize.width) / 2,
(screenSize.height - frameSize.height) / 2);
/** add buttons to the database form
public JButton(String text,Icon icon)
Creates a button with initial text and an icon.
Parameters:
text - the text of the button.
icon - the Icon image to display on the button
JButton newButton = new JButton (" New ", new ImageIcon(DatabaseApp.class.getResource("img/New.gif")));
JButton addButton = new JButton (" Add ", new ImageIcon (DatabaseApp.class.getResource("img/Add.gif")));
JButton findButton = new JButton (" Retrieve ", new ImageIcon (DatabaseApp.class.getResource("img/Find.gif")));
JButton updateButton = new JButton (" Update ", new ImageIcon (DatabaseApp.class.getResource("img/Refresh.gif")));
JButton deleteButton = new JButton (" Delete ", new ImageIcon (DatabaseApp.class.getResource("img/Delete.gif")));
JButton submitButton = new JButton (" Submit Query ", new ImageIcon (DatabaseApp.class.getResource("img/Export.gif")));
JButton reportButton = new JButton (" Report File ", new ImageIcon (DatabaseApp.class.getResource("img/AlignLeft.gif")));
/** create tabbed pane for form
* public void addTab(String title,Icon icon,Component component,String tip)
* Parameters:
* title - the title to be displayed in this tab
* icon - the icon to be displayed in this tab
* component - The component to be displayed when this tab is clicked.
* tip - the tooltip to be displayed for this tab
public DatabaseApp() {
// create new tabbedPane object
JTabbedPane tabbedPane = new JTabbedPane(){
ImageIcon imageIcon = new ImageIcon("img/logo.jpg");
Image image = imageIcon.getImage();
public void paintComponent (Graphics g) {
g.setColor(new Color(220,220,220));
g.fillRect(0,0,643,74);
g.drawImage(image, 0, 4, this);
super.paintComponent(g);
tabbedPane.addTab(" Team Management ",null, buildQueryPanel(), "Team Management");
tabbedPane.addTab(" Player Registration ",null, buildGeneralPanel(), "Player Registration");
tabbedPane.addTab(" Author ",null, buildAuthorPanel(), "Author");
// assign layout manager
//setLayout(new GridLayout(1,1));
tabbedPane.setSelectedIndex(1);
tabbedPane.setBorder(BorderFactory.createEmptyBorder(78,0,0,0));
add(tabbedPane);
protected JPanel buildQueryPanel() {
JPanel mainPane = new JPanel();
// divided into three panes. these panes will be added to mainPanel
JPanel westPane = new JPanel();
JPanel centrePane = new JPanel();
JPanel southPane = new JPanel();
// assign the layout managers
mainPane.setLayout(new BorderLayout());
westPane.setLayout(new GridLayout(4,1));
centrePane.setLayout(new GridLayout(4,1));
// create array of Panels for label textfield and buttons and make them left align
Panel labelPane[] = new Panel[4];
Panel buttontxtPane[] = new Panel[4];
Panel textPane[] = new Panel[1];
for (int i=0; i < labelPane.length; ++i) {
labelPane[i] = new Panel();
labelPane.setLayout(new FlowLayout(FlowLayout.LEFT));
for (int i=0; i < buttontxtPane.length; ++i) {
buttontxtPane[i] = new Panel();
buttontxtPane[i].setLayout(new FlowLayout(FlowLayout.LEFT));
for (int i=0; i < textPane.length; ++i) {
textPane[i] = new Panel();
textPane[i].setLayout(new FlowLayout(FlowLayout.LEFT));
// add different label to the labelPane
labelPane[0].add(new JLabel("Database:"));
labelPane[1].add(new JLabel("Query:"));
labelPane[2].add(new JLabel("Report File:"));
labelPane[3].add(new Label(""));
// textfields
buttontxtPane[0].add(dbase);
buttontxtPane[1].add(query);
buttontxtPane[2].add(report);
// buttons
buttontxtPane[3].add(submitButton);
submitButton.setMnemonic('s');
buttontxtPane[3].add(reportButton);
reportButton.setMnemonic('r');
// text area to view the result
textPane[0].add(displayArea);
// add action listener to buttons
submitButton.addActionListener(new ButtonHandler());
reportButton.addActionListener(new ButtonHandler());
for(int i=0; i < labelPane.length; ++i)
westPane.add(labelPane[i]);
for(int i=0; i < buttontxtPane.length; ++i)
centrePane.add(buttontxtPane[i]);
for(int i=0; i < textPane.length; ++i)
southPane.add(textPane[i]);
mainPane.add(westPane, BorderLayout.WEST);
mainPane.add(centrePane, BorderLayout.CENTER);
mainPane.add(southPane,BorderLayout.SOUTH);
return mainPane;
/**Create a JPanel for General tab, divide it into three JPanels for label, displaytext
* and buttons.Assign a Flowlayout manager to each panel. Add label, textfield
* and buttons to respective panel. following constructors will be used
* for Jlabel
* public JLabel(String text)
* Creates a JLabel instance with the specified text. The label is aligned against the leading edge of its display area, and centered vertically.
* Parameters:
* text - The text to be displayed by the label.
protected Component buildGeneralPanel() {
// main panel
JPanel mainPanel = new JPanel();
// divided into three panes. these panes will be added to mainPanel
JPanel westPane = new JPanel();
JPanel centrePane = new JPanel();
JPanel southPane = new JPanel();
// assign the layout managers
mainPanel.setLayout(new BorderLayout());
westPane.setLayout(new GridLayout(12,1));
centrePane.setLayout(new GridLayout(12,1));
// create array of Panels for label textfield and buttons and make them left align
Panel labelPane[] = new Panel[12];
Panel textPane[] = new Panel[12];
Panel buttonPane[] = new Panel[2];
for (int i=0; i < labelPane.length; ++i) {
labelPane[i] = new Panel();
labelPane[i].setLayout(new FlowLayout(FlowLayout.LEFT));
for (int i=0; i < textPane.length; ++i) {
textPane[i] = new Panel();
textPane[i].setLayout(new FlowLayout(FlowLayout.LEFT));
for (int i=0; i < buttonPane.length; ++i) {
buttonPane[i] = new Panel();
buttonPane[i].setLayout(new FlowLayout(FlowLayout.LEFT));
// add different label to the labelPane
labelPane[0].add(new JLabel("Employee No"));
labelPane[1].add(new JLabel("Name"));
labelPane[2].add(new JLabel("Address"));
labelPane[3].add(new JLabel("Suburb"));
labelPane[4].add(new JLabel("State"));
labelPane[5].add(new JLabel("PostCode"));
labelPane[6].add(new JLabel("Date of Birth"));
labelPane[7].add(new JLabel("Home Phone"));
labelPane[8].add(new JLabel("Work Phone"));
labelPane[9].add(new JLabel("Mobile"));
labelPane[10].add(new JLabel("E-mail"));
// add textfield component to textPane
textPane[0].add(employeeID);
textPane[1].add(name);
textPane[2].add(address);
textPane[3].add(suburb);
textPane[4].add(state);
textPane[5].add(pCode);
textPane[6].add(dob);
textPane[7].add(homePh);
textPane[8].add(workPh);
textPane[9].add(mobile);
textPane[10].add(eMail);
// add button to buttonPane and assign keyboard key for shortcut e.g Alt + n
buttonPane[0].add(newButton);
newButton.setMnemonic('n');
buttonPane[0].add(addButton);
addButton.setMnemonic('a');
buttonPane[0].add(findButton);
findButton.setMnemonic('r');
buttonPane[0].add(updateButton);
updateButton.setMnemonic('u');
buttonPane[0].add(deleteButton);
deleteButton.setMnemonic('d');
// add actionlistener to the buttons
newButton.addActionListener(new ButtonHandler());
addButton.addActionListener(new ButtonHandler());
findButton.addActionListener(new ButtonHandler());
updateButton.addActionListener(new ButtonHandler());
deleteButton.addActionListener(new ButtonHandler());
for (int i = 0; i < labelPane.length; ++i)
westPane.add(labelPane[i]);
for (int i = 0; i < textPane.length; ++i)
centrePane.add(textPane[i]);
for (int i = 0; i < buttonPane.length; ++i)
southPane.add(buttonPane[i]);
mainPanel.add(westPane,BorderLayout.WEST);
mainPanel.add(centrePane,BorderLayout.CENTER);
mainPanel.add(southPane,BorderLayout.SOUTH);
return mainPanel;
protected JPanel buildAuthorPanel(){
JPanel authorPanel = new JPanel();
JPanel authorPane = new JPanel();
authorPanel.setLayout(new BorderLayout());
authorPane.setLayout(new GridLayout(9,1));
Panel pane[] = new Panel[9];
for (int i=0; i < pane.length; i++) {
pane[i] = new Panel();
pane[i].setLayout(new FlowLayout(FlowLayout.CENTER));
pane[0].add(new JLabel(""));
pane[1].add(new JLabel(""));
pane[2].add(new JLabel(""));
pane[3].add(new JLabel(""));
pane[4].add(new JLabel("Name:Jasper Lim Jiqiang"));
pane[5].add(new JLabel("Admin:992365G"));
pane[6].add(new JLabel(""));
pane[7].add(new JLabel(""));
pane[8].add(new JLabel(""));
for (int i=0; i < pane.length; i++)
authorPane.add(pane[i]);
authorPanel.add(authorPane, BorderLayout.CENTER);
return authorPanel;
Maybe something like this:
<code>
JTabbedPane tabbedPane = new JTabbedPane();
JPanel introPanel = new JPanel();
introPanel.add(createIntroPanel());
ImageIcon img = new ImageIcon(getResourceString("tabIconFile"));
tabbedPane.addTab(getResourceString("introTab"), img, introPanel);
</code>
plus
<code>
protected JPanel createIntroPanel()
JPanel pane = new IntroPanel();
return pane;
</code>
Klint
Similar Messages
-
How do you turn java code into an .exe or etc...
I can't seem to figure out how to turn my java code into an executable in windows so that it runs by itself without a comipler, can someone help? (without using visual J++).
I can't seem to figure out how to turn my java code
into an executable in windows so that it runs by
itself without a comipler, can someone help? (without
using visual J++).I saw a tutorial on that, you might want to check it out.
http://developer.java.sun.com/developer/onlineTraining/new2java/divelog/?frontpage-headlinesfeatures -
How can I add advertisement code into flash game?
hi mates,
just want to ask about loading advertisement code!
How do you add the advertisement code (adsense) into flash games??
my site Funny Games have over 5k games but they are getting from others sites thus I have no original files. How can I add more code into the current files?Unless the games were pre-made to allow you to specify some variables in the page code or some external file, you won't be having any luck... you cannot add code to the games unless you have the source files, which you apparently don't have.
-
How do enter my product code into a trial version when I have a student copy of Adobe Photoshop CS6
How do enter my product code into a trial version when I have a student copy of Adobe Photoshop CS6
Redemption Code Help
Installing and Activating a Try & Buy product
Mylenium -
How to conver this sqlserver code into Oracle
Hi,
Any one can help me how to covert below sqlserver code into Oracle?
DECLARE @t1 DATETIME;
DECLARE @t2 DATETIME;
SET @t1 = GETDATE();
select * from table;
SET @t2 = GETDATE();
SELECT DATEDIFF(millisecond,@t1,@t2) AS elapsed_ms;Hi,
Do Like This ,
This is The function going to calculate elapsed time ,execute this before the second script,
CREATE function DATEDIFF
startTime in timestamp with time zone,
endTime in timestamp with time zone
return number
as
interval_ interval day (9) to second (3);
begin
interval_ := endTime - startTime;
return (extract(day from (interval_)) * 86400 +
extract(hour from (interval_)) * 3600 +
extract(minute from (interval_)) * 60 +
extract(second from (interval_))) * 1000;
end;And this Is the Script that i converted to oracle,
SET server out put on;
DECLARE
v_t1 TIMESTAMP;
v_t2 TIMESTAMP;
lv_cur sys_refcursor;
lv_elapsed VARCHAR2 (30);
BEGIN
v_t1 := SYSTIMESTAMP;
OPEN lv_cur FOR
SELECT *
FROM emp;
v_t2 := SYSTIMESTAMP;
SELECT datediff (v_t1, v_t2) elapsed_ms
INTO lv_elapsed
FROM DUAL;
DBMS_OUTPUT.put_line (v_t1);
DBMS_OUTPUT.put_line (v_t2);
END;Thanks & Rgds
BCV. -
How can i rewrite this code into java?
How can i rewrite this code into a java that has a return value?
this code is written in vb6
Private Function IsOdd(pintNumberIn) As Boolean
If (pintNumberIn Mod 2) = 0 Then
IsOdd = False
Else
IsOdd = True
End If
End Function
Private Sub cmdTryIt_Click()
Dim intNumIn As Integer
Dim blnNumIsOdd As Boolean
intNumIn = Val(InputBox("Enter a number:", "IsOdd Test"))
blnNumIsOdd = IsOdd(intNumIn)
If blnNumIsOdd Then
Print "The number that you entered is odd."
Else
Print "The number that you entered is not odd."
End If
End Sub873221 wrote:
I'm sorry I'am New to Java.Are you new to communication? You don't have to know anything at all about Java to know that "I have an error," doesn't say anything useful.
I'm just trying to get you to think about what your post actually says, and what others will take from it.
what does this error mean? what code should i replace and add? thanks for all response
C:\EvenOdd.java:31: isOdd(int) in EvenOdd cannot be applied to ()
isOdd()=true;
^
C:\EvenOdd.java:35: isOdd(int) in EvenOdd cannot be applied to ()
isOdd()=false;
^
2 errors
Telling you "what code to change it to" will not help you at all. You need to learn Java, read the error message, and think about what it says.
It's telling you exactly what is wrong. At line 31 of EvenOdd.java, you're calling isOdd(), with no arguments, but the isOdd() method requires an int argument. If you stop ant think about it, that should make perfect sense. How can you ask "is it odd?" without specifying what "it" is?
So what is this all about? Is this homework? You googled for even odd, found a solution in some other language, and now you're just trying to translate it to Java rather than actually learning Java well enough to simply write this trivial code yourself? -
(AS3) How to divide my code into classes/package
Anyone familiar with this? I have already tried dividing
among classes and it is not working.
I have created the following code that pulls data from an
external xml file into a datagrid. I have been trying to figure out
how to get it to function using classes and/or packages. I'd like
to separate the functionality into separate classes for each of the
following:
1) A class for loading the XML file(s) (there will likely be
more datagrids and more xml files)
2) A class for "drawing" the datagrid based on the xml
.... others you can think of??
I have attached the code in question.
Thanks,
MarkClasses in AS3 need to be in packages now, e.g.:
// package needs to be included in same directory with FLA or
in class look up targets
package {
// import statements go here
// needs to be public for access outside of package
directory
public class NewXMLClass {
// again public makes it accessible to other classes
public function NewXMLClass() {}
// inlcude your methods here
use an import statement to use it in other classes e.g.
import NewXMLClass;
Hope that helps... -
How to transform this pascal code into java code!
I want to transform this pascal code into java code . Please tel me how to do it because I really don't know how to do it!
Thanks!
{CALCULATE HOHN-LONDON FACTORS}
var kk:tab4;
PROCEDURE INTENS(var kk:tab4);
begin
for n:=0 to nr+2 do
begin
kk^[1,n]:=sqrt(lup*lup*yg*(yg-4)+4*sqr(n+1)) +lup*(yg-2);
kk^[2,n]:= sqrt(lup*lup*yg*(yg-4)+4*sqr(n+1))-lup*(yg-2);
kk^[3,n]:=0.5*(kk^[1,n]*kk^[1,n]+4*(sqr(n+1)-lup*lup));
kk^[4,n]:= 0.5*(kk^[2,n]*kk^[2,n]+4*(sqr(n+1)-lup*lup));
kk^[5,n]:= sqrt(ldown*ldown*yd*(yd-4)+4*sqr(n+1)) +ldown*(yd-2);
end;
end;
BEGIN
new (kk);
intens(kk);
writeln(f2,' ','N ','V','branch ','H-L');
for n:=1 to np do
begin
fp1[n,v]:=(n-ldown)*(n+ldown+1)*sqr(kk^[2,n-1]*kk^[6,n]+4*(n+ldown)*(n-ldown+1));
fp1[n,v]:=fp1[n,v]/(4*(n+0.5)*kk^[4,n-1]*kk^[8,n]) ;
writeln(f2,' ',n,' ',v,' fp1 ',fp1[n,v]:10:2);
end;
for n:=1 to nq do
begin
fq1[n,v]:=sqr(kk^[2,n]*kk^[6,n]*(ldown+0.5)+4*(n-ldown+1)*(n+ldown+1)*(ldown-0.5)) ;
fq1[n,v]:=fq1[n,v]/(2*(n+0.5)*kk^[4,n]*kk^[8,n]*(n+1.5));
fq1[n,v]:=fq1[n,v]*(n+1);
writeln(f2,' ',n,' ',v,' fq1 ',fq1[n,v]:10:2);
end;
for n:=1 to nr do
begin
fr1[n,v]:=sqr(kk^[2,n+1]*kk^[6,n]+4*(n-ldown+2)*(n+ldown+1));
fr1[n,v]:=fr1[n,v]/(4*kk^[4,n+1]*kk^[8,n]*(n+1.5));
fr1[n,v]:=fr1[n,v]*(n-ldown+1)*(n+ldown+2) ;
writeln(f2,' ',n,' ',v,' fr1 ',fr1[n,v]:10:2);
end;Basically it looks like this:
public class KK{
private your_type[][] kk = new your_type[length][length];
private void intens(your_type[] kk){
for(int n= 0; n<nr+2; n++){
kk[1][n] = Math.sqrt(lup*lup*yg*(yg-4)+4*Math.pow((n+1), 2)) +lup*(yg-2);
kk[2][n] = Math.sqrt(lup*lup*yg*(yg-4)+4*Math.pow((n+1), 2))-lup*(yg-2);
kk[3][n] = 0.5*(kk[1][n]*kk[1][n]+4*(Math.pow((n+1), 2)-lup*lup));
kk[4][n] = 0.5*(kk[2][n]*kk[2][n]+4*(Math.pow((n+1), 2)-lup*lup));
kk[5][n] = Math.sqrt(ldown*ldown*yd*(yd-4)+4*Math.pow((n+1), 2)) +ldown*(yd-2);
public static void main(String args[]){
KK k = new KK();
k.intens(kk);
System.out.println(f2 + ' ' + 'N ' + 'V' + 'branch ' + 'H-L');
for(int n=1; n < np; n++){
fp1[n][v] = (n-ldown)*(n+ldown+1)*Math.pow((kk[2][n-1]*kk[6][n]+4*(n+ldown)*(n-ldown+1)), 2);
fp1[n][v] = fp1[n][v]/(4*(n+0.5)*kk[4][n-1]*kk[8][n]) ;
System.out.println(f2 + ' ' + n + ' ' + v + ' fp1 ' + fp1[n][v]:10:2);
for(int n=1; n< nq;n++){
fq1[n][v] = Math.pow((kk[2][n]*kk[6][n]*(ldown+0.5)+4*(n-ldown+1)*(n+ldown+1)*(ldown-0.5)), 2);
fq1[n][v] = fq1[n][v]/(2*(n+0.5)*kk[4][n]*kk[8][n]*(n+1.5));
fq1[n][v] = fq1[n][v]*(n+1);
System.out.println(f2 + ' ' + n + ' ' + v + ' fq1 ' + fq1[n][v]:10:2);
for(int n=1; n < nr; n++){
fr1[n][v] = Math.pow((kk[2][n+1]*kk[6][n]+4*(n-ldown+2)*(n+ldown+1)), 2);
fr1[n][v] = fr1[n][v]/(4*kk[4][n+1]*kk[8][n]*(n+1.5));
fr1[n][v] = fr1[n][v]*(n-ldown+1)*(n+ldown+2) ;
System.out.println(f2 + ' ' + n + ' ' + v + ' fr1 ' + fr1[n][v]:10:2); //fr1[n][v]:10:2 --> Here you must use the BigDecimal class
}I'm not very sure because my pascal knowledge is extremely "dated".
What about the converter I told you about? -
Created my own subscription box in animate, how to embed the mail code into the symbols?
So i think I am on the right track, I am trying to embed my mailchimp code into my animate site, and I decided to build my own text box and button in animate and convert them into symbols. Both text box and button or inside of a bigger symbol so that they stay in a responisive design. however when I tryin and plug in the mail code it just puts the subscription box behind my symbols. Is this because html code doesnt work in animate or am I just really stupid and am doing it all wrong? Ha probably the second part, . Any help would be great!.
Animate CC code
<div id="Stage_Center2_Subscription">
<div id="Stage_Center2_Subscription_subscribe"></div>
<div id="Stage_Center2_Subscription_Submittbutton">
<div id="Stage_Center2_Subscription_Submittbutton_Submitbutton">
<div id="Stage_Center2_Subscription_Submittbutton_Submitbutton_RoundRect2"></div>
</div>
<div id="Stage_Center2_Subscription_Submittbutton_text">
<div id="Stage_Center2_Subscription_Submittbutton_text_Text">Join</div>
</div>
</div>
<div id="Stage_Center2_Subscription_Textbox">
<div id="Stage_Center2_Subscription_Textbox_textbox">
<div id="Stage_Center2_Subscription_Textbox_textbox_RoundRect"></div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
Mailchimp code
<!-- Begin MailChimp Signup Form -->
<link href="//cdn-images.mailchimp.com/embedcode/slim-081711.css" rel="stylesheet" type="text/css">
<style type="text/css">
#mc_embed_signup{background:#fff; clear:left; font:14px Helvetica,Arial,sans-serif; }
/* Add your own MailChimp form style overrides in your site stylesheet or in this style block.
We recommend moving this block and the preceding CSS link to the HEAD of your HTML file. */
</style>
<div id="mc_embed_signup">
<form action="http://kandied.us3.list-manage.com/subscribe/post?u=4525b320bd81872705a48ea05&id=4743a970b 1" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
<input type="email" value="" name="EMAIL" class="email" id="mce-EMAIL" placeholder="email address" required>
<!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->
<div style="position: absolute; left: -5000px;"><input type="text" name="b_4525b320bd81872705a48ea05_4743a970b1" value=""></div>
<div class="clear"><input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button"></div>
</form>
</div>
<!--End mc_embed_signup-->Hi, Kyle-
What's happening is that you're inserting static HTML into the base HTML of your current project. We treat any third party static HTML as underneath all managed elements. You can find out whether or not it's being treated as static by hovering over the element in the elements panel:
One thing you can do is to dynamically insert your mailchimp code into a div by changing the html() property of that div using jQuery. So, something like this:
In compositionReady:
sym.$("myDiv").html("INSERT MY FORM CODE HERE");
Hope that points you in the right direction!
-Elaine -
How do i break this code.
All,
I am getting the "PLS-00123: program too large error"
when i execute the following code. Is there a way i can break the huge
update statement.
Please suggest me.
PROCEDURE PR_UPD_FACT ( v_Part in varchar2 )
IS
fupd_stmnt VARCHAR2(19190);
upd_cid NUMBER;
upd_recnum NUMBER;
BEGIN
fupd_stmnt :=
'UPDATE ' ||v_Part|| ' SET ' ||
'WRKG01_ASM_BODY_DONE_Y = ' || 'TO_DATE(' || '''' || to_char
(ods_record.WRKG01_ASM_BODY_DONE_Y,'DD/MON/YY HH:MI:SS') || ''''
|| ',' || '''' || 'DD/MON/YY HH:MI:SS' || '''' || ')' || ',' ||
'WRKG01_ASM_BUCK_Y = ' || 'TO_DATE(' || '''' || to_char(
ods_record.WRKG01_ASM_BUCK_Y,'DD/MON/YY HH:MI:SS') || '''' || ','
|| '''' || 'DD/MON/YY HH:MI:SS' || '''' || ')' || ',' ||
-- *** UPDATTING 366 COLUMNS OF A HUGE TABLE ***
' WHERE ' ||
' WRKG01_CNT_MDL_YEAR_C = ' || '''' || ods_record.WRKG01_CNT_MDL_YEAR_C || '''' ||
' AND WRKG01_ORD_PROD_SRC_C = ' || '''' || ods_record.WRKG01_ORD_PROD_SRC_C || '''' ||
' AND WRKG01_ORD_PROD_ORD_ID_C = ' || '''' || ods_record.WRKG01_ORD_PROD_ORD_ID_C || '''';
upd_cid := DBMS_SQL.OPEN_CURSOR;
DBMS_SQL.PARSE(upd_cid, fupd_stmnt, DBMS_SQL.NATIVE);
upd_recnum := DBMS_SQL.EXECUTE(upd_cid);
DBMS_SQL.CLOSE_CURSOR(upd_cid);
END PR_UPD_FACT;
Thank YouI can't tell which Oracle version you are on, but the limit for v7.x is 64K, v8.0 (up to 8.1.3) is 128K, and 8i and up have a limit of 256M.
One thing you should definitely incorporate - regardless of whether you split up this statement - is bind variables. Instead of hardcoding the literal values within the string, just assign placeholders and then, on a call(s) to dbms_sql.bind_variable, supply the value(s).
So instead of:
'WRKG01_ASM_BODY_DONE_Y = ' || 'TO_DATE(' || '''' || to_char (ods_record.WRKG01_ASM_BODY_DONE_Y,'DD/MON/YY HH:MI:SS')
use:
'wrkg01_asm_body_done_y = :w01abd'
and then, after the call to dbms_sql.parse but before dbms_sql.execute:
dbms_sql.bind_variable(upd_cid, 'w01abd', to_char(ods_record.wrkg01_asm_body_done_y, 'DD/MON/YY HH:MI:SS'));
Also use bind variable for the parameters in your WHERE clause. You will still need to hardcode the table and column names (as you do for the tablename parameter v_part).
Now, using bind variables is extremely important, but it doesn't help your size issue. Is this procedure in a package? It might be, but I couldn't tell. If not, it probably should be.
http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:571023051648
Another thing you might try is to break the update into two steps, each handled in a separate procedure (or separate packages). Now, if you are updating a column included in the WHERE clause, then this will not be a viable option.
Just some initial thoughts... -
How to compile the java code into machine execution code?
Does anyone can tell me how to compile java code into machine execution code on specific OS platform such as Windows2000 , UNIX �Ketc.
Thanks a lot !Hi SIR
It is very kind of you to give me so great informatin!
Thanks a lot!
Caton -
How do I manually enter code into an iweb page??
iweb blogging is not bad; but there are times when I want to enter html code by hand; maybe a form script or CSS code.
I tried inputting the code into the blog.html page, but it will vanish every time I update iweb.
So; how can I manually add code to an iweb page? Surely this is possible?
thanksOf course it's possible. Lots of us do that on our pages already. Two things to keep in mind...1. No way to do this via iWeb directly, so it involves editing the published html files, and 2. Because iWeb republishes the html files whenever you update the your webpage, you will lose your changes and have to redo them to add your HTML back.
The general directions are as follows (using banner code as an example)...
1. Decide where you want your banner and know exactly what dimensions you need.
2. Insert a text box onto your page and adjust its size to exactly your dimensions.
3. Type in some uniquely identifiable text like, "BANNERCODEHERE" without changing the font or anything else...just type it in.
4. Publish your page with iWeb.
5. Find the html file associated with your published page (either on your iDisk or in a folder depending on how you published) and open it in any text editor (like Microsoft Word, or Textedit, or anything).
6. Scroll through the html file and locate your placeholder text, e.g. "BANNERCODEHERE".
7. Replace the placeholder text with your html code and publish your page.
That's it. You should see your html coded element show up where you placed the text box.
If any of this information is useful to you, please do me a favor and mark my reply as "solved" or "helpful" using the little buttons that you see in the title bar of this reply. I would appreciate it immensely. Thank you. -
How can I break one track into several tracks
Hello all,
Im new to Mac and garageband, My problem is when i spin a full set of lets say 2 hours into garage band as 1 track, how can I go back and break that 1 track into several tracks so when I make a cd people can change from track to track instead of listening to one track all the way through.
Thanks in AdvanceOk now that I chose the region how would I export it?
Just select "export".
And Also Do I have to export each track one by one to itunes?
Since you want to burn a CD, you need several sound files, and GB only exports one file at a time. -
How to convert pl/sql code into java/j2ee
Hi,
We have a PL/SQL Oracle App server application that we will support if we can convert in j2ee/java. But when i did take a look at the code, these pl/sql contains all HTML and java code inside the stored procedures.
And iam looking to explore some tools and mechanisms that can convert these pl/sql in a JAVA application so that i can deploy this new app into my BEA81 environment.
Does any body has any idea:
a) How to convert from pl/sql > java ?
b) Any plugins or tools of BEA that can run these pl/sql (the way thay are currently...i.e w/o converting) in BEA 81 container ?
thanks, sangitathese pl/sql contains all HTML and java code insideJava or JavaScript. They are not the same. I wouldn't expect to see Java inside html, whereas JavaScript would be intermixed. On the other hand you might have a java stored proc (Oracle 9/10) which is generating HTML.
>
Does any body has any idea:Refactor.
I doubt it just has html and JavaScript/Java. So what you have is a mess that mixes several things that should have been seperate in the first place. -
How do I break music files into smaller pieces to save battery life?
Apple claims that ipod battery life is improved if music files are less than 9mb for some reason that involves having to load music into the cache more often. Most of my music files are much larger than 9mb and I would like to break up the files into smaller pieces. How can I do this using itunes? Or do I need to use another program?
Most likely the reason your songs are over 9 MB are because they were recorded or "Ripped" In a high bit rate. The bit rate is basicly how many bits per second are played. the higher the bit rate the better the sound is in most cases. in MP3's 128kbs is CD qualidy and is the average, theres also 160kbs and 192kbs. anything above 192 most humans can't tell the difference. theres 2 things u can do, if you have the music on CD u can take the time to rip them again at a lower bit rate MP3 in iTunes or you can have iTunes convert all your songs into the AAC format. If you convert them to AAC tho, you will only be able to play them on your iPod and iTunes only.
You may be able to find free software that will convert all your mp3s to a lower bit rate or compact them more but there are other things you can do to extend your battery. Make sure your iPods EQ setting is off, shorted the amount of time the backlight is on in the iPod settings, lower the volume while playing ur iPod will save the battery. Another thing is to make a good playlist of all the songs u like, so your not constantly switching to other songs. every time u switch songs the iPod has to spin the harddrive inside it and thats a big power drain on the battery.
Maybe you are looking for
-
I have an ASA 5505 router. I have configured most of the rules, but have had assistance from online forums and outside consultants configuring some rules. There is one in my configuration that I do not understand, and I do not remember entering it my
-
Can someone help me with the error to prepare my project?
"This project contained a sequence that could not be opened. No sequence preview preset file or codec could be associated with this sequence type." I get this error when I want to open my project file in adobe cs6. The project file is only psd-format
-
My ipod freezed up...won't do anything
my ipod is completley frozen...it won't do anything....it won't even reset i've tried plugging it into my computer but that doesn't work either. the hold won't work either please help
-
ISE Admin Menu Access Policy and Network Resources
Hello Board, Does someone experience the same issue as me, if using an Admin Menu Access Policy? First of all, I'm using the latest ISE release (1.1.3.124 with patch 1). I created a custom Administrator Menu Access Policy (Admin Access -> Authorizati
-
I have a CSS11506 with an SSL module loaded. The CSS is gigabit trunked to an L2 switch. Load balancing the web servers, running on port 80, is working fine with standard HTTP. Once enabling SSL on the CSS and trying to access the service via HTTPS,