Writing UTL procedure - Urgent Urgent...
Hi there
We are currently using Oracle 8i and 9ias.
We are executing a UTL file package in a stored procedure which creates a text file in .csv format (comma delimited). This file is saved on the server.
How do I save the file on my local machine instead of server.
I know its possible on client/server platforms. But on Web???
Cheers
Pavan
Thanks very much for your reply Shay.
Can you please let me know what are the steps to be followed/implementing for web.showdocument after the file has been created in a .csv format with comma delimited.
Regards
Pavan Chelvaraj
Similar Messages
-
Problem with writing a procedure with table name as an input parameter
Hi all,
I am writing a procedure with table name as an input parameter:
below is the code
create or replace procedure prc(in_tbl in varchar2)
as
begin
execute immediate ' truncate table tlb ';
insert into tbl
select a,b,c from in_tbl;
end;user579585 wrote:
Hi all,
I am writing a procedure with table name as an input parameter:
below is the code
create or replace procedure prc(in_tbl in varchar2)
as
begin
execute immediate ' truncate table tlb ';
insert into tbl
select a,b,c from in_tbl;
end;You'll also need to use dynamic sql for the insert:
execute immediate 'begin insert into tbl select a,b,c from '||in_tbl||'; end'; -
Writing stored procedures.--PLSQL
Hello,
Need help in learning and writing stored procedures.
Scenario is :-
Tabes:-
Employee -->
* Fields are (empl_id,fname,lname,employee_status)*
* values ( 1,P,M,A)*
* (2,JK,KK,A)*
* (3,lk,kj,a)*
Project->
*(Project_id,Projname,duration)*
* 1 CLEANING*
* 2 driving*
Project and Employee---RELATIONSHIP ---> proj_id and employee_id
Employee_project_reltn
*(project_id,employee_id,created_dt,duration,status)*
1 1
1 3
2 3
{color:#0000ff}_An employee can work in multiple projects(1-MANY) at a time. _{color}
Question:- Please help me with the PROCEDURE for getting all EMPLOYEE details of a PROJECT.
That means, ---->Input is PROJECT_ID as 1 ----RESULT is employee details of employee no 1 and 3 + Project details fully
{color:#0000ff}*(1)I don know how to return the entire result set filled with data.Please help me writing the correct full procedure.*{color}
{color:#0000ff}*(2)Also, a Procedure to add an employee to a project.Inputs are employee_id,project_id*{color}Hi,
If the table Employee_project_reltn has correct foreign keys defined you can attemp to do the insert and if a integrity constrain is violated (ORA-02291) then the exception invalid_employee_or_project is raised.
As a starting point:
CREATE OR REPLACE PROCEDURE proc_add_employee_to_project(p_employee_id IN Employee_project_reltn.employee_id%TYPE,
p_project_id IN Employee_project_reltn.project_id%TYPE,
p_message OUT VARCHAR2) IS
invalid_employee_or_project EXCEPTION;
PRAGMA EXCEPTION_INIT(invalid_employee_or_project,
-2291);
BEGIN
p_message := 'Succesful';
-- Your insert
-- commit;
EXCEPTION
WHEN invalid_employee_or_project THEN
p_message := 'invalid_employee_or_project';
ROLLBACK;
WHEN OTHERS THEN
p_message := SQLERRM;
ROLLBACK;
END proc_add_employee_to_project;
/Regards, -
Hi,
I want to write a procedure.
SQL>insert into test_table(name,job) values('xyz','sales');
SQL>insert into test_table(name,job) values('abc','IT');
If any of the above SQL statement fails then it has to rollback the complete transaction.
can any one help me in writing such procedure please.
Thank You All..I googled and found the solution.
The solution is
create or replace procedure test as
WHENEVER SQLERROR EXIT SQL.SQLCODE ROLLBACK;
WHENEVER OSERROR EXIT SQL.SQLCODE ROLLBACK;
begin
insert into test_table(name,job) values('xyz','sales');
insert into test_table(name,job) values('abc',2);
end;
when any of the above transaction fails above procedure is rolling back the transaction and at the same time it is disconnecting the user from oracle.This is actually what i am looking for. -
Writing a Procedure to return back XML. Please help.
Hello,
I am writing a procedure in Oracle 10G,that will return back an XML
to me.
I am passing 2 parameters to this procedure (a Quantity and a Price) and these parameters are element values of the XML that will be returned.
My Query is :
1) How can the arguments being passed to the procedure become element values.
2) Is my procedure to return back the XML correct.? Please can someone modify this procedure?
Please can someone help me with this procedure as this is a PROD issue.
Help really appreciated.
PROCEDURE getTradeXML(qty IN VARCHAR2,price IN VARCHAR2 xml IN OUT CLOB)
IS
xml CLOB;
BEGIN
xml = 'SELECT XMLELEMENT("Trade", XMLELEMENT("Quantity",qty),
XMLELEMENT("Price", price))
FROM DUAL'
END;PROCEDURE getTradeXML(qty IN VARCHAR2,price IN
VARCHAR2 xml IN OUT CLOB)
IS
xml CLOB;
BEGIN
xml = 'SELECT XMLELEMENT("Trade",
XMLELEMENT("Quantity",qty),
MLELEMENT("Price", price))
FROM DUAL'maybe you want
SELECT XMLELEMENT("Trade", XMLELEMENT("Quantity",qty), XMLELEMENT("Price", price)) into xml FROM DUAL;
/*not tested*/ -
Confusion when writing Stored Procedure...
Iam having confusion when writing Stored Procedure.Plz solve my confusion.
Can we write Stored Procedure using JDBC like the Code I have given.If So,what is the wrong i had made in the Code?.Iam using MySQL 5.0.27.
If it can't be done with the code that i had written, Iam telling Some steps that I have learned,suggest, whether it is correct or not?
Step 1:
Create Stored Procedure in database separately.We can't create stored procedure in JDBC(Am I Right?).
Step 2:
After writing Stored procedure call the procedure inside JDBC using preparecall method of callable statement.
Code:
try
Class.forName(dbDriver).newInstance();
out.println("<b>MySQL Driver Loaded Sucessfully </b>"+"<br>");
connection=DriverManager.getConnection ("jdbc:mysql://localhost:3306/exportproc? user=root&password=sachin");
statement = connection.createStatement();
out.println("<b>Statement Created</b>");
sql="create procedure exportproc(in name varchar(15),in password varchar(12))"
+"begin"
+"insert into exportproc values(name,password)"
+"end";
out.println("<b>Query assigned to sql</b>"+"<br>");
statement.executeUpdate("create database exportproc");
statement.executeUpdate("use exportproc");
statement.executeUpdate(sql);
out.println("Table Created");
}Message was edited by:
sachindevhi,
create a stored procedure in mysql , i dont know mysql , any way we take your code
create procedure exportproc(in name varchar(15),in password varchar(12))
begin
insert into exportproc values(name,password)
endprocedure created ....
now just call in java by using CallableStatement
ex:
CallableStatement cs = con.prepareCall("{call exportproc(?,?)}");
cs.setString (1, "vijay");
cs.setString (2, "123");
cs.executeUpdate (); -
Hi,
i havea requirement where in i should be able to call my shell script through oracle stored procedure.i tried the following way..but iam unable to get the result.please find the details below.
new.sh - my shell script - lctfile (LCTFILE) is the input pa
v_config_file=`find $FND_TOP -name LCTFILE
FNDLOAD apps/s0ccer@$dxbs1 0 Y DOWNLOAD $v_config_file /home/bir4163/RPT33/bin/menu.ldt MENU MENU_NAME='AR_NAVIGATE_GUI'
if [ $? != 0 ];then
echo "$DATE $0 FNDLOAD DOWNLOAD Failed!" | tee -a $LOG_FILE
else
echo "SUCCESS" | tee -a $LOG_FILE
fi
CREATE OR REPLACE PROCEDURE test_dbms_scheduler
AS
v_text VARCHAR2 (255) := 'AR_NAVIGATE_GUI';
BEGIN
DBMS_OUTPUT.put_line ('I am in Procedure');
DBMS_SCHEDULER.create_job (
job_name => 'test_dbms_scheduler',
job_action => '/home/bir4163/RPT33/bin/new.sh',
number_of_arguments => 1,
job_type => 'executable',
start_date => SYSDATE,
repeat_interval => 'FREQ=SECONDLY; INTERVAL=1',
enabled => FALSE,
auto_drop => FALSE,
comments => 'run shell script'
DBMS_SCHEDULER.set_job_argument_value (job_name => 'test_dbms_scheduler',
argument_position => 1,
argument_value => v_text);
DBMS_SCHEDULER.enable ('test_dbms_scheduler');
DBMS_OUTPUT.put_line ('I am back in Procedure');
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line (SQLCODE || SQLERRM);
END;
But iam unable to test it as i do not have permissions to access dbms_scheduler.can anybody tell me how to solve this using DBMS_PIPE with a sample code.
please do help its very urgent
thanks
ramyaHi,
Register your Shell Script as a concurrent program, Executable execution method "Host", then use fnd_request.submit_request to submit the program.
Regards,
Andries -
PROCEDURE PROBLEM, URGENT ...
Hi ,
I am geting an error while puting hint in a sub query. The query is like this
SELECT /*+ INDEX (EMP EMPIDX) */
EMPNO
FROM EMP
WHERE DEPTNO IN (SELECT /*+ INDEX (DEPIDX) */ DEPTNO FROM DEP);
My query is similar to the above one. And this query is part of Cursor defination in a Procedure. So when i try to compile the procedure it gives me error like
PDE-USW002 The source of the stored program unit source is incomplete.
QUESTION IS HOW TO AVOID THE ERROR. Because if i remove the hint this statement takes about 21 mins, if I put the hint it runs in 30 seconds. So I need the hints put in place badly . Please suggest something . This is very urgent .
Thanks
FerozIf that is really what is causing the problem and it won't compile in Forms Builder, then about the only way would be to create a server-side package/procedure, and call the procedure from the form and do the work on the server, and pass back the results to the form via parameters in the procedure call.
-
Procedure help (urgent)
i AM NEW TO ORACLE
I created this procedure
PROCEDURE P_SUPLR IS
SUPPLIER VARCHAR2(2000);
cursor c1 is SELECT DISTINCT(M.SPLR)supplier FROM DM_MARKETING M
WHERE M.SPLR IN ('ZEG','ZUS','USK');
BEGIN
for rec in c1 loop
supplier := rec.supplier;
end loop;
Dbms_out.put_line(supplier);
END;
But the output is getting only 'ZUS'
BUT I NEED TO GET OUTPUT FOR SUPPLIER IS
'ZEG',ZUS','USK'
CAN ANYBODY MODIFY THE CODE AND HELP ME PLEASE
ITS URGENT
Thanks in advanceYou just need to change the dbms_output.put_line position so that it is inside the loop. If you have a large number of values to display on screen, it may be worth doing SET SERVEROUTPUT ON SIZE 500000 in SQLPLUS before you execute the procedure....
PROCEDURE P_SUPLR IS
SUPPLIER VARCHAR2(2000);
cursor c1 is SELECT DISTINCT(M.SPLR)supplier FROM DM_MARKETING M
WHERE M.SPLR IN ('ZEG','ZUS','USK');
BEGIN
for rec in c1 loop
supplier := rec.supplier;
Dbms_output.put_line(supplier);
end loop;
END;HTH
David -
Hello All,
I have some flat files which contain data in the form of single continuous line stream (i.e. without carriage returns in the file).
I am supposed to read those file(s) and import the data in Database tables.
The file size may be greater than 32767 bytes .
for that I am using UTL_FILE package and its funtions.
e.g for Opening file to read I use.
UTL_FILE.FOPEN( 'my_location', 'my_file_namet', 'R',32767)
but, as the maximum no of bytes we can open/read from a single line is 32767 for UTL_FILE.FOPEN funtion . Its really limiting my performance.
as u can check the follwing link for the limitaion
http://download-east.oracle.com/docs/cd/B19306_01/appdev.102/b14258/u_file.htm#i1003526
Is there any way to get rid out of this?
Can I read files having more than 32767 bytes in a single line?
Pls help.
regards,
Abhijit.Did you consider the following routines from the DBMS_LOB package?:
PROCEDURE loadfromfile(dest_lob IN OUT NOCOPY BLOB,
src_lob IN BFILE,
amount IN INTEGER,
dest_offset IN INTEGER := 1,
src_offset IN INTEGER := 1);
PROCEDURE loadfromfile(dest_lob IN OUT NOCOPY CLOB CHARACTER SET ANY_CS,
src_lob IN BFILE,
amount IN INTEGER,
dest_offset IN INTEGER := 1,
src_offset IN INTEGER := 1);
PROCEDURE loadblobfromfile(dest_lob IN OUT NOCOPY BLOB,
src_bfile IN BFILE,
amount IN INTEGER,
dest_offset IN OUT INTEGER,
src_offset IN OUT INTEGER);
PROCEDURE loadclobfromfile(dest_lob IN OUT NOCOPY CLOB CHARACTER SET ANY_CS,
src_bfile IN BFILE,
amount IN INTEGER,
dest_offset IN OUT INTEGER,
src_offset IN OUT INTEGER,
bfile_csid IN NUMBER,
lang_context IN OUT INTEGER,
warning OUT INTEGER); -
Procedure Error, Urgent please help ?!
I have create a program unit in dev 6.0, this program run with trigger WHEN-NEW-FORM-INSTANCE.
My table is
KODE KET
10 TEST1
20 TEST2
30 TEST3
My procedure is
Declare
vkode number(2);
vket varchar2(14);
CURSOR TEST_cur IS SELECT Kode, Ket FROM PUSAT.TEST ORDER BY Ket Desc;
Begin
OPEN TEST_cur;
Loop
FETCH TEST_cur INTO vkode, vket;
EXIT WHEN TEST_cur%NOTFOUND;
message(vkode);
End Loop;
CLOSE TEST_cur;
End;
but, i have message error :
FRM-40735: WHEN-NEW-FORM-INSTANCE trigger raised unhandled exception ORA-00942
please help me, i don't know how to solve this error.
Thank you
hendra
nullUse exceptions like :
Begin
OPEN TEST_cur;
Loop
FETCH TEST_cur INTO vkode, vket;
EXIT WHEN TEST_cur%NOTFOUND;
message(vkode);
End Loop;
CLOSE TEST_cur;
Exception
when no_data_found then
message (There is no data to find');
End;
null -
Dynamic prompting with stored procedures XI- urgent
Post Author: moleary77
CA Forum: Crystal Reports
I have a report that has 7 parameters and two stored procedures, I get the dynamic prompting to work wonders as stand alone dynamic parameters, however I need them to be cascading. How can I accomplish this while still using my stored procedures? Is there something I need to change within the stored procedure, I've looked all over in Crystal and I can't seem to figure it out. Please let me know! Below are my stored procs
set ANSI_NULLS ONset QUOTED_IDENTIFIER ONGOALTER PROCEDURE [dbo].[gm_RPT_Appt_Parms]-- Add the parameters for the stored procedure hereASBEGIN-- SET NOCOUNT ON added to prevent extra result sets from-- interfering with SELECT statements.SET NOCOUNT ON;-- Insert statements for procedure hereDECLARE @PTABLE TABLE(COMPANY VARCHAR(10) NULL,BOOKCODE VARCHAR(22) NULL,FACILITY VARCHAR(47) NULL,PROV VARCHAR(21) NULL,LOGONID VARCHAR(15) NULL,DEPARTMENT VARCHAR(26) NULL)--GET COMPANIESINSERT INTO @PTABLE(COMPANY, BOOKCODE, DEPARTMENT ) SELECT DISTINCT COMPANY , BOOKCODE, DEPARTMENT FROM MWBOOK ORDER BY COMPANY , BOOKCODE, DEPARTMENT INSERT INTO @PTABLE(COMPANY, FACILITY ) SELECT DISTINCT COMPANY, FACILITY FROM CLFAC ORDER BY COMPANY, FACILITY INSERT INTO @PTABLE(COMPANY, PROV ) SELECT DISTINCT COMPANY , PROV FROM MWPROV ORDER BY COMPANY , PROV SELECT * FROM @PTABLE
END
set ANSI_NULLS ONset QUOTED_IDENTIFIER ONGOALTER PROCEDURE [dbo].[gm_RPT_Appt_Data] -- Add the parameters for the stored procedure here @START DATETIME, @END DATETIME, @COMPANY VARCHAR(10), @BOOK VARCHAR(2056) = NULL, @USERCODE varchar(2056) = NULL, @FACILITY varchar(2056)= NULL, @PROV varchar(2056) = NULLASBEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements.DECLARE @VALUES VARCHAR(2000) SET NOCOUNT ON; IF(@BOOK IS NULL) BEGIN SET @VALUES = '' SELECT @VALUES = @VALUES + COALESCE(BOOKCODE + ',','') FROM MWBOOK WHERE COMPANY = @COMPANY SET @BOOK = @VALUES END IF(@FACILITY IS NULL) BEGIN SET @VALUES = '' SELECT @VALUES = @VALUES + COALESCE(FACILITY + ',','') FROM CLFAC WHERE COMPANY = @COMPANY SET @FACILITY = @VALUES END IF(@USERCODE IS NULL) BEGIN SET @VALUES = '' SELECT @VALUES = @VALUES + COALESCE(LOGONID + ',','') FROM CLUSER WHERE COMPANY = @COMPANY SET @USERCODE = @VALUES END
IF(@PROV IS NULL) BEGIN SET @VALUES = '' SELECT @VALUES = @VALUES + COALESCE(PROV + ',','') FROM MWPROV WHERE COMPANY = @COMPANY SET @PROV = @VALUES END SELECT mws.ANOTE, mwb.BOOKNAME, mwb.FACILITY, LEFT(mwa.PATIENTID, 50) AS PATIENT, mwa.ADATE, mwa.ADESC, mwa.ANOTE, mwa.USERCODE, mwa.BOOK, mwa.USERFLAG, mwa.ATIME, mwa.COMPANY, mwa.AKEYTIME, mwb.PROV FROM dbo.MWAPPTS mwa LEFT OUTER JOIN dbo.MWBOOK mwb ON mwa.COMPANY = mwb.COMPANY AND mwa.BOOK=mwb.BOOKCODE LEFT OUTER JOIN dbo.MWSCHED mws ON mwa.ADATE=mws.ADATE AND mwa.BOOK=mws.BOOK AND mwa.COMPANY = mws.COMPANY WHERE mwa.BOOK IN (SELECT ARRTEXT FROM DBO.SPLIT(@BOOK, ',')) AND mwa.USERCODE IN (SELECT ARRTEXT FROM DBO.SPLIT(@USERCODE, ',')) AND mwa.ADATE BETWEEN @START AND @END AND mwb.FACILITY IN (SELECT ARRTEXT FROM DBO.SPLIT(@FACILITY, ',')) AND mwa.COMPANY=@COMPANY AND (mwb.PROV IN (SELECT ARRTEXT FROM DBO.SPLIT(@PROV, ','))) ORDER BY MWA.ADATE, MWA.BOOK
ENDSince your {?Project} parameter is part of a stored procedure, you have to think of it as part of the table.  In reality, it could "change" the result set so Crystal has always prompted them first. It's like in math with the order of operation between +-*/.Â
All "added" parameters (like the one you created within the report) must be prompted after the server-based prompts (stored proc).
- Kathryn Webster (Report Design Specialist) -
Error 701, not enough procedure cache (*Urgent*)
Hi All,
Is there a SQL that I can use to determine the SPID that is the root cause of a 701 (not enough procedure cache)?
Additional information:
This is happening in 2 servers; 15G memory with 2G procedure cache and 10G memory with 1.25G procedure cache.
Environment: Sun Solaris 10 running ASE 15.0.3 ESD#4
Monitoring has been enabled.
Sybase recommends either increasing the procedure cache or running dbcc proc_cache(free_unused) periodically.
I would rather identify the process causing it or the configuration setting in these 2 environment that is causing this to happen.
Thanks in advance.
AnilAnother thing you might try is the dbcc memusage command. It will display the 20 biggest things in procedure cache, so if a few extraordinarily large cached procedures are the cause of the 701s, this may identify what the objects are. It won't identify who first ran it, though, or even show if any spid is currently executing any of those 20 items.
Example:
1> set switch on 3604
2> go
Switch 3604 ('print_output_to_client') is turned on.
All supplied switches are successfully turned on.
1> dbcc memusage
2> go
Memory Usage:
Meg. 2K Blks Bytes
Configured Memory: 156.2500 80000 163840000
Non Dynamic Structures: 5.3751 2753 5636252
Dynamic Structures: 123.1582 63057 129140736
Cache Memory: 9.0098 4613 9447424
Proc Cache Memory: 17.5703 8996 18423808
Unused Memory: 1.1191 573 1173504
Buffer Cache Memory, Top 8:
Cache Buf Pool DB Id Partition Id Index Id Meg.
default data c 31515 8 0 0.0117
2K 31515 8 0 0.0117
default data c 1 8 0 0.0039
2K 1 8 0 0.0039
default data c 4 8 0 0.0039
2K 4 8 0 0.0039
default data c 2 8 0 0.0020
2K 2 8 0 0.0020
default data c 3 8 0 0.0020
2K 3 8 0 0.0020
default data c 5 8 0 0.0020
2K 5 8 0 0.0020
default data c 14 8 0 0.0020
2K 14 8 0 0.0020
default data c 31514 8 0 0.0020
2K 31514 8 0 0.0020
Procedure Cache, Top 20:
Database Id: 31514
Object Id: 121048436
Object Name: sp_downgrade_esd
Version: 1
Uid: 1
Type: stored procedure
Number of trees: 0
Size of trees: 0.000000 Mb, 0.000000 bytes, 0 pages
Bytes lost for alignment 0 (Percentage of total: 0.000000)
Number of plans: 1
Size of plans: 1.217173 Mb, 1276298.000000 bytes, 628 pages
Bytes lost for alignment 6488 (Percentage of total: 0.508345)
Database Id: 31514
Object Id: 905051229
Object Name: sp_do_poolconfig
Version: 1
Uid: 1
Type: stored procedure
Number of trees: 0
Size of trees: 0.000000 Mb, 0.000000 bytes, 0 pages
Bytes lost for alignment 0 (Percentage of total: 0.000000)
Number of plans: 1
Size of plans: 1.080750 Mb, 1133248.000000 bytes, 582 pages
Bytes lost for alignment 3674 (Percentage of total: 0.324201)
Database Id: 31515
Object Id: 1344004788
Object Name: sp_dbcc_run_faultreport
Version: 1
Uid: 1
Type: stored procedure
Number of trees: 1
Size of trees: 0.972553 Mb, 1019796.000000 bytes, 501 pages
Bytes lost for alignment 4609 (Percentage of total: 0.451953)
Number of plans: 0
Size of plans: 0.000000 Mb, 0.000000 bytes, 0 pages
Bytes lost for alignment 0 (Percentage of total: 0.000000) -
Very urgent urgent plz somebody help me to this question..
hai plz somebody reply me?
I have created materialized view for my report.
but i cant seem them used in sql inspector tab.its directly querried from tables..
but i want to use materialized view in my report to enhance theperformance..plz help me..
i checked my privlleges...but i am struggling for this 1week..i could not find where it goes wrong..
grant CREATE TABLE to <user>;
SQL> grant CREATE VIEW to <user>;
SQL> grant CREATE PROCEDURE to <user>;
SQL> grant CREATE ANY MATERIALIZED VIEW to <user>;
SQL> grant DROP ANY MATERIALIZED VIEW to <user>;
SQL> grant ALTER ANY MATERIALIZED VIEW to <user>;
SQL> grant GLOBAL QUERY REWRITE to <user> with admin option;
SQL> grant ANALYZE ANY to <user>;
SQL> grant SELECT ON V_$PARAMETER to <user>;
the above privellegs have been given to the owner of the EUL.
But i cant see the usage of materialized view..i have sent plus option,query governor tab-always when summary table visible option..but still not solved?
plz reply me urgently its very urgent...
regard
luxmiIf Swahili is not on the list and you would like to recommend it to Apple, please tell them at http://apple.com/feedback
This is the User support forums operated by users just like yourself. Apple rarely appears here. -
URGENT, URGENT - Table not displaying correctly
hi guys
I am using a Jtable as a leaf node to a jtree. The table is editable, and displays the cells, but doesnt dislay the header or the left side border of the table.
here is my code:
Can somebody tell me why ? .. this is urgent. thanks
public class SimpleTree extends JFrame {
public static void main(String[] args) {
new SimpleTree();
public SimpleTree() {
super("Creating a Simple JTree");
WindowUtilities.setNativeLookAndFeel();
addWindowListener(new ExitListener());
Container content = getContentPane();
Container content2 = getContentPane();
JComboBox comboBox;
comboBox = new JComboBox();
comboBox.addItem("true");
comboBox.addItem("false");
JTable table;
String columnNames[] = { "OrderID", "CustomerID", "EmployeeID", "Order Date", "Shipped Date" };
String dataValues[][] =
{ "34", "34" , "67","12/02/2002", "16/04/2002" },
{ "-123", "43", "853","12/02/2002", "16/04/2002" },
{ "93", "89.2", "109","12/02/2002", "16/04/2002" },
{ "279", "9033", "3092","12/02/2002", "16/04/2002" }
table = new JTable( dataValues, columnNames );
table.setEnabled(true);
table.isCellEditable(4,4);
table.setShowHorizontalLines(true);
table.setShowVerticalLines(true);
table.getTableHeader().setForeground(Color.black);
table.getTableHeader().setBackground(Color.lightGray);
table.getTableHeader().setReorderingAllowed(true);
table.getTableHeader().resizeAndRepaint();
JTableHeader header = table.getTableHeader();
header.setUpdateTableInRealTime(true);
header.setReorderingAllowed(true);
JScrollPane jScrollPane = new JScrollPane(table);
Object[] hierarchy =
{ "Orders",
table,
new Object[] { "Orders",
new Object[] { "Prodcuts",
new Object[] { "",
table },
"Employees",
"Suppliers" };
DefaultMutableTreeNode root = processHierarchy(hierarchy);
JTree tree = new JTree(root);
tree.putClientProperty("JTree.lineStyle", "Angled");
tree.setCellRenderer(new MyTreeCellRenderer(table));
tree.setCellEditor(new SimpleTreeCellEditor(table));
tree.repaint();
table.repaint();
tree.setRowHeight(-2);
tree.setEditable(true);
content.add(new JScrollPane(tree), BorderLayout.CENTER);
setSize(275, 300);
setVisible(true);
/** Small routine that will make node out of the first entry
* in the array, then make nodes out of subsequent entries
* and make them child nodes of the first one. The process is
* repeated recursively for entries that are arrays.
private DefaultMutableTreeNode processHierarchy(Object[] hierarchy) {
DefaultMutableTreeNode node =
new DefaultMutableTreeNode(hierarchy[0]);
DefaultMutableTreeNode child;
for(int i=1; i<hierarchy.length; i++) {
Object nodeSpecifier = hierarchy;
if (nodeSpecifier instanceof Object[]) // Ie node with children
child = processHierarchy((Object[])nodeSpecifier);
else
child = new DefaultMutableTreeNode(nodeSpecifier); // Ie Leaf
node.add(child);
return(node);I don't know for sure, but I imagine that your CellEditor and CellRenderer return the table when they should probably return the JScrollPane that contains the table. I suppose I should be more worried seeing as the fate of the world depends on this very problem. You know the president called me just the other day asking the same thing. I realize that we might run out of clean air or water if this is not solved, but I got some other things to do right now...
Maybe you are looking for
-
Reg: Problem in XML PUBLISHER Report
Hi all, I am working building report using xml publisher. Problem i facing was , *1. I created the template in RTF and attached to data definition* for eg: my rtf is sno item quantity price ( I created this field in table structure and mapped to xml
-
HT1329 Moving movies and tv shows to new computer.
If I move my iTunes library to another computer using my iPod in disk mode, will it move my movies and tv shows as well? Any help would be appreciated.
-
TS3648 Windows support software error, boot camp, MBP OS X 10.8.3
I get this same error, "The Windows support software could not be saved to the selected folder. An error occurred while saving the Windows support software", when running boot camp assistant on OS X 10.8.3, which is installed on my MBP from mid-2012,
-
Just upgraded to Lion and cannot open files on my old SL partition - permissions error
I have just installed Lion on my 2008 MacPro on a new internal HD and cannot open word/text etc files on the original Snow Leopard disc. I get a permissions error. I can preview the file but not open it. When I do a get info, I can add my user an
-
Aperture or Adobe photoshop CS4?
Hi Mac lovers! i love photography!, I currently own a D200 Nikon DSLR, I am an amateur photographer--- so should I go with Adobe CS4 which i have used in the past or should i give a test run to this unknown software (unknown for me) Aperture, I know