How to exclude the each row of the result set XML declaration?
HelloI have a table with an XMLTYPE column and would like to SELECT a set of rows. How can I exclude the each row of the result set XML declaration? My query currently looks like this, I am running through Spring JDBC:
SELECT XMLSerialize FROM t1 WHERE XMLEXISTS('$e/Event' PASSING XMLTEXT AS "e") ORDER BY t1.time DESC myschema.event (HAPPY t1.xmltext)
After selecting, in my application I convert each line in a string and concatenate all the rows in a large chain to analyze in a DOM model. I get a parser exception (org.xml.sax.SAXParseException: the target of the processing instruction corresponding to "[xX] [mM] [he's]" is not allowed) because there are several XML statements in my large chain. Of course, I could manually check the string on each line if it starts with the XML declaration, but it would be nicer if I could load the DB does not add it in the first place. Is there a way?
Thank you!
-Daniela
Hello
Some options that I can think of:
SELECT XMLSerialize(CONTENT
XMLtransform(t1.xmltext,
xmltype('
')
)
)
FROM myschema.event t1
WHERE XMLEXISTS('$e/Event' PASSING XMLTEXT AS "e")
ORDER BY t1.time DESC
;
or quite simply,.
SELECT XMLSerialize(CONTENT
extract(t1.xmltext,'/')
)
FROM myschema.event t1
WHERE XMLEXISTS('$e/Event' PASSING XMLTEXT AS "e")
ORDER BY t1.time DESC
;
Tags: Database
Similar Questions
-
Ask... How to reach the result sets in order?
Let me give a few examples of data first to give an idea of what I am working with:
Oracle: 10g
So what I try to do is right out of names (ALAN, CHRIS, DAN) in ascending order (according to out of name) and then all the names (AMY, BILL, BOB, CARL, DEREK) in ascending order (according to out name)... and I want all of this in a single result set. So basically the first set of names in alphabetical order, followed by the rest of the names in alphabetical order.--Table xTable NAME DESC_ID ALAN 2 AMY 3 BILL 5 BOB 7 CARL 1 CHRIS 8 DAN 4 DEREK 6
I want the output to look exactly like this:
I tried the following, but it doesn't seem to workNAME DESC_ID ALAN 2 CHRIS 8 DAN 4 AMY 3 BILL 5 BOB 7 CARL 1 DEREK 6
The code above seems terribley unefficent and apparently not at the exit of the things in the order I want. Any ideas?select distinct a.name, a.desc_id from xTable, (select distinct name, desc_id from xTable where DESC_ID in (2,8,4) order by name ) type1, (select distinct name, desc_id from xTable where DESC_ID in (1,3,5,6,7) order by name ) type2 where desc_id in (type1, type2);
Published by: user652714 on January 5, 2010 11:23
Published by: user652714 on January 5, 2010 11:28If you have a known list of DESC_ID you could do something like this:
SQL> WITH xTable AS 2 ( 3 SELECT 'ALAN' AS NAME, 1 AS TYPE_ID, 2 AS DESC_ID FROM DUAL UNION ALL 4 SELECT 'AMY' AS NAME, 2 AS TYPE_ID, 3 AS DESC_ID FROM DUAL UNION ALL 5 SELECT 'BILL' AS NAME, 2 AS TYPE_ID, 5 AS DESC_ID FROM DUAL UNION ALL 6 SELECT 'BOB' AS NAME, 2 AS TYPE_ID, 7 AS DESC_ID FROM DUAL UNION ALL 7 SELECT 'CARL' AS NAME, 2 AS TYPE_ID, 1 AS DESC_ID FROM DUAL UNION ALL 8 SELECT 'CHRIS' AS NAME, 1 AS TYPE_ID, 8 AS DESC_ID FROM DUAL UNION ALL 9 SELECT 'DAN' AS NAME, 1 AS TYPE_ID, 4 AS DESC_ID FROM DUAL UNION ALL 10 SELECT 'DEREK' AS NAME, 2 AS TYPE_ID, 6 AS DESC_ID FROM DUAL 11 ) 12 SELECT NAME 13 , DESC_ID 14 FROM xTable 15 ORDER BY 16 (CASE 17 WHEN DESC_ID IN (2,8,4) THEN 1 18 WHEN DESC_ID IN (1,3,5,6,7) THEN 2 19 END) 20 , 1 21 / NAME DESC_ID ----- -------------------- ALAN 2 CHRIS 8 DAN 4 AMY 3 BILL 5 BOB 7 CARL 1 DEREK 6 8 rows selected.
Another option would be to use the UNION, but he strikes the table twice instead of once as described above:
SQL> WITH xTable AS 2 ( 3 SELECT 'ALAN' AS NAME, 1 AS TYPE_ID, 2 AS DESC_ID FROM DUAL UNION ALL 4 SELECT 'AMY' AS NAME, 2 AS TYPE_ID, 3 AS DESC_ID FROM DUAL UNION ALL 5 SELECT 'BILL' AS NAME, 2 AS TYPE_ID, 5 AS DESC_ID FROM DUAL UNION ALL 6 SELECT 'BOB' AS NAME, 2 AS TYPE_ID, 7 AS DESC_ID FROM DUAL UNION ALL 7 SELECT 'CARL' AS NAME, 2 AS TYPE_ID, 1 AS DESC_ID FROM DUAL UNION ALL 8 SELECT 'CHRIS' AS NAME, 1 AS TYPE_ID, 8 AS DESC_ID FROM DUAL UNION ALL 9 SELECT 'DAN' AS NAME, 1 AS TYPE_ID, 4 AS DESC_ID FROM DUAL UNION ALL 10 SELECT 'DEREK' AS NAME, 2 AS TYPE_ID, 6 AS DESC_ID FROM DUAL 11 ) 12 SELECT NAME 13 , DESC_ID 14 FROM 15 ( 16 SELECT NAME 17 , DESC_ID 18 , 1 AS ORD_COL 19 FROM xTable 20 WHERE DESC_ID IN (2,8,4) 21 UNION 22 SELECT NAME 23 , DESC_ID 24 , 2 AS ORD_COL 25 FROM xTable 26 WHERE DESC_ID IN (1,3,5,6,7) 27 ) 28 ORDER BY ORD_COL 29 , NAME 30 / NAME DESC_ID ----- -------------------- ALAN 2 CHRIS 8 DAN 4 AMY 3 BILL 5 BOB 7 CARL 1 DEREK 6 8 rows selected.
-
How to exclude the result of the query of account?
I am stuck how can I update my request.
Can anyone help please?
CREATE TABLE "LOGON"."LOGON_DATA" ( "CLIENT" VARCHAR2(20 BYTE) NOT NULL ENABLE, "ROW_ID" NUMBER NOT NULL ENABLE, "OUR_ACCOUNT" VARCHAR2(1 BYTE), "DATE_OF_LOGON" VARCHAR2(20 BYTE) NOT NULL ENABLE, "LOGON_ID" NUMBER NOT NULL ENABLE, );
SAMPLE of DATA (for a "client" for a day):
PETER123,021,N,10-01-2015,121514 PETER123,022,,10-01-2015,121514 PETER123,023,N,10-01-2015,221514 PETER123,024,Y,10-01-2015,221514 PETER123,025,Y,10-01-2015,221514 PETER123,026,Y,10-01-2015,221514 PETER123,027,Y,10-01-2015,221514 PETER123,028,N,10-01-2015,221514 PETER123,029,,10-01-2015,221559 PETER123,030,Y,10-01-2015,221600 PETER123,189,N,10-01-2015,225601 PETER123,201,Y,10-01-2015,233539
...
10 million lines
12 c - 12.1.0.1.1 - I used 'insert' in SQL Developer to load Oracle data.
The query below counts everything after the first 'our_account' = there is found and excludes in double "logon_id" County, but...
WITH got_first_row_id AS ( SELECT client, logon_id , row_id , MIN ( CASE WHEN our_account = 'Y' THEN row_id END ) OVER (PARTITION BY client) AS first_row_id FROM LOGON_DATA where date_of_logon = '10-01-2015' ) SELECT client, COUNT(DISTINCT logon_id) AS cnt FROM got_first_row_id WHERE row_id > first_row_id GROUP BY client order by COUNT(DISTINCT logon_id) desc;
.. .but how can I also exclude "logon_id" number which is + 1 in the previous result?
i.e.
If my result will be logon_id = 225500 - I don't want to count the 225501 but I count on 225502
The query must rely to the extent indicated in pink:
PETER123, 021, N-10-01-2015, 121514
PETER123, 022, 10-01-2015, 121514
PETER123, 023, N-10-01-2015, 221514
PETER123, 024, Y, 10-01-2015, 221514
PETER123, 025, Y, 10-01-2015, 221514
PETER123, 026, Y, 10-01-2015, 221514
PETER123, 027, Y, 10-01-2015, 221514
PETER123, 028, N-10-01-2015, 221514
PETER123, 029, 10-01-2015, 221559
PETER123, 030, Y, OCTOBER 1 00
PETER123, 189, N-10-01-2015, 225601
PETER123, 201, Y, 10-01-2015, 233539
the expected result would be
customer, cnt
PETER123, 4
Very appreciated for any help.
Using
If I understand your problem, the implementation in your case might be like this:
WITH evaluated_logons AS
(SELECT
customer,
logon_id,
ROW_ID,
MIN (DECODE (our_account, 'Y', row_id)) compared to first_row_id (partition by customer).
LAG (logon_id, 1, -1) on previous_logon_id (partition sales order by logon_id)
OF logon_data
WHERE date_of_logon = TO_DATE (1 October 2015 ', 'MM DD YYYY')
)
SELECT
customer,
Count (*) AS cnt
Of evaluated_logons
WHERE
-do not count Y first
ROW_ID > first_row_id
-count only nonsequtive logon_ids
AND previous_logon_id + 1<>
Customer GROUP
NTC to ORDER BY DESC
;
-
How to exclude the missing files or library locations that are on a network backup and restore of Windows 7 Professional drive. To give you more information, I have photos stored on a network drive to the following address: Wirelessspace\LaCie\MyPhotoGallery\Family. This folder is a location of library under the images. Because this folder is on a network drive backup backup not file Wizard.
In addition, the following file locations is not found because they no longer exist. So why the backup wizard continues to look for and how to remove the backup set? I guess the error code following each line means simply that records cannot be found. Is this correct?
Backup has encountered a problem during backup of the C:\Windows\System32\config\systemprofile\Searches\Google file. Error: (the system cannot find the specified file. (0 x 80070002))
Backup has encountered a problem during backup of the C:\Windows\System32\config\systemprofile\SyncUP file. Error: (the system cannot find the specified file. (0 x 80070002))
Backup has encountered a problem during backup of the C:\Windows\System32\config\systemprofile\Podcasts file. Error: (the system cannot find the specified file. (0 x 80070002))Hello
I suggest you to follow the steps in the article below and check if it helps.
Error code 0 x 80070002 when you back up files in Windows 7: http://support.microsoft.com/kb/979281
Hope this information is useful.
-
How to test a procedure returns the result set
Hello
I have a following code:
{color: #0000ff} create or replace the TYPES of PACKAGING
AS
type cursorType is ref cursor;
end;
create or replace PROCEDURE GetAllCategories (p_cursor in the Types.cursorType)
AS
Start
Open p_cursor for SELECT * CATEGORY;
end; {color}
I would like to test the procedure of * {color: #000000} visualization output resultset {color} *. How can I do with SQL Developer?
In fact, when select RUN in SQL Developer, I got the following code:
DECLARE
P_CURSOR types.cursorType;
BEGIN
GetAllCategories (P_CURSOR = & gt; P_CURSOR);
END;
When I run it, it is successful but there is no result set displayed. However if I execute SELECT * FROM category only in the SQL Editor, I see the result set in the grid. Then where the result set did when he went through the procedure?
Thanks in advance for any help.
Published by: CarbonFiber Sep 22, 2008 20:52Is a simple way with sqlplus
SQL> create or replace package types 2 as 3 type cursortype is ref cursor; 4 end; 5 / Package created. SQL> create or replace procedure getallemp(p_cursor in out types.cursortype ) 2 as 3 begin 4 open p_cursor for select * from emp; 5 end; 6 / Procedure created. SQL> var lcursor refcursor SQL> SQL> exec getallemp(:lcursor) PL/SQL procedure successfully completed. SQL> print lcursor EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO DIV ---------- ---------- --------- ---------- --------- ---------- ---------- ---------- ---------- 7369 SMITH CLERK 7902 17-DEC-80 800 20 10 7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30 10 7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30 10 7566 JONES MANAGER 7839 02-APR-81 2975 20 10 7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30 10 7698 BLAKE MANAGER 7839 01-MAY-81 2850 30 10 7782 CLARK MANAGER 7839 09-JUN-81 2450 10 10 7788 SCOTT ANALYST 7566 19-APR-87 3000 20 10 7839 KING PRESIDENT 17-NOV-81 5000 10 10 7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30 10 7876 ADAMS CLERK 7788 23-MAY-87 1100 20 10 EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO DIV ---------- ---------- --------- ---------- --------- ---------- ---------- ---------- ---------- 7900 JAMES CLERK 7698 03-DEC-81 950 30 10 7902 FORD ANALYST 7566 03-DEC-81 3000 20 10 7934 MILLER CLERK 7782 23-JAN-82 1300 10 10 14 rows selected.
Thank you
Knani. -
How to change the language setting in Microsoft word to generate a list of references?
How to change the language setting in Microsoft word to generate a list of references?
I use a Mac with the (traditional) Chinese language setting, and I need the reference generatinga list for my document in English!
If you don't get an answer here, try the forums devoted entirely to problems with MS applications:
-
Don't know how to read the results of netstat EI s list? If I received 860592506 bytes sent from 43421482 how to convert MB? And does this mean byte received?
Hello
This shows the total number of bytes transmitted and received via the Ethernet card. This is the total of the amount of use up to this day.
This includes all the Web sites you have visited and emails you sent, etc..
You can calculate using one of the following methods:
Method 1:
860592506 / 1048576 = 820,72 MB
Method 2:
Multiply 860592506 with 9.53674316 * 10 ^-7 that will give us the result in mega bytes.
860592506 bytes = 820 MB 9MB not, accept my apology for the miscalculation.
Similarly 43421482 acroos = 40MB -
How to change the default setting for Australian News & Sport?
How to change the default setting for Australian News & Sport?
What setting, probably your browser home page, and how you do that depends on what browser you ar using.
If using IE opens this page, then click on the "gear" icon to the rt at the top of the page, select Internet Options and look in the general tab
-
How to refresh the result iterator to uncommitted changes
Hello
JDev 11.1.2.4
I have a VO with a VC. In my AM I exposed 2 VO:
VO1 = VO without the VC
VO2 = VO with the VC
I have in my user interface:
VO1-based array in which I can add, update, or delete rows.
a button that shows a popup that contains a table based on VO2
Scenario: update
I make a modification on an existing line. The change is made on automatic transmission of true - field.
I click on the button
The table on the shortcut menu shows the changed value
Ok
Scenario 1: create
I have create a new line. Fields to create the new line are all send auto = true
I click on the button
The table on the shortcut menu does not show the new line. It shows only the last State (original + changed lines lines)
KO
Scenario 1: remove
I delete an existing line.
I click on the button
The table on the shortcut menu does not show the deleted row. It shows only the last State (original + changed lines lines)
KO
Q: what can I do, for the table on the shortcut menu shows the current status (non-validated data). I tried to refresh the iterator after a creation or deletion, but I still get the old data?
DCIteratorBinding myIterator = ADFUtils.findIterator (iterator); myIterator.executeQuery (); myIterator.refresh (DCIteratorBinding.RANGESIZE_UNLIMITED); Thank you
It depends on the vo and the Victoria Cross. The two vo must rest on the same area of occurrence. The Victoria Cross should have mode query so (memory and db) and the Victoria Cross on the second vo should be in a way that the new line would be part of the result set if given th could be read from db.
Timo
-
How to clear the read setting preferred
Hello
I hope someone can advise me how to remove the read setting preferred in ASM 11.2.0.3?
I'm trying to set an empty string, but it gives me an error.
Thank you!
SQL > alter system set asm_preferred_read_failure_groups = "sid = '+ ASM3;
ALTER system set asm_preferred_read_failure_groups = "sid = '+ ASM3.
*
ERROR on line 1:
ORA-02097: the parameter cannot be changed because specified value is not valid
ORA-01078: failure in the treatment of system settings
Hello
You can remove it using command, below
SQL > ALTER SYSTEM reset ASM_PREFERRED_READ_FAILURE_GROUPS sid = '+ ASM3;
As you try the node 3...
Kind regards
Loriette
-
How to display the result of a java class in InputText?
Hi all
How can I get the result of the java classes to InputText or OutputText?
also everyone in the forum can road map me to deal with Java in oracle adf because I am a beginner in oracle adf
I saw a few samples in corner of oracle adf, but it is difficult for me.I use JDeveloper Version 11.1.2.3, technology of the Adf.
My question is how to return the result of java Bean InputText or OutText
Thank yousee if you want to have show some .so beans instance variable value you can have a few bean .define managed a variable as
string abc = "abc";create the getter set for her.
in the value property of inputText or OutPutText write an el as #{beanscope.managedbeanName.abc}
-
How to judge the backup set is available (with RMAN)?
Hi all, after you back up the database, how to judge the backup set is available?
SQL > SELECT * FROM V$ VERSION;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
AMT for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Productionrman target / Recovery Manager: Release 11.2.0.1.0 - Production on Mon Jul 9 12:28:51 2012 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. connected to target database: CATDB (DBID=2328696599) RMAN> crosscheck backupset; allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=24 device type=DISK crosschecked backup piece: found to be '*AVAILABLE*' backup piece handle=D:\ORACLE\FAST_RECOVERY_AREA\CATDB\BACKUPSET\2012_06_14\O1_MF_NNNDF_TAG201206 14T153439_7XMHL0JL_.BKP RECID=34 STAMP=785950480 crosschecked backup piece: found to be '*AVAILABLE*' backup piece handle=D:\ORACLE\FAST_RECOVERY_AREA\CATDB\BACKUPSET\2012_06_14\O1_MF_ANNNN_TAG201206 14T153546_7XMHN2C6_.BKP RECID=35 STAMP=785950546 crosschecked backup piece: found to be '*AVAILABLE*' backup piece handle=D:\ORACLE\FAST_RECOVERY_AREA\CATDB\AUTOBACKUP\2012_06_14\O1_MF_S_785950547_7X MHN4MH_.BKP RECID=36 STAMP=785950548 crosschecked backup piece: found to be '*AVAILABLE*' backup piece handle=D:\ORACLE\FAST_RECOVERY_AREA\CATDB\AUTOBACKUP\2012_06_14\O1_MF_S_785953535_7X MLKN66_.BKP RECID=37 STAMP=785953539 crosschecked backup piece: found to be '*AVAILABLE*' backup piece handle=D:\ORACLE\FAST_RECOVERY_AREA\CATDB\AUTOBACKUP\2012_06_14\O1_MF_S_785971797_7X N4D6YF_.BKP RECID=38 STAMP=785971798 crosschecked backup piece: found to be '*AVAILABLE*' backup piece handle=D:\ORACLE\FAST_RECOVERY_AREA\CATDB\AUTOBACKUP\2012_06_29\O1_MF_S_787249342_7Y V4001O_.BKP RECID=39 STAMP=787249359 Crosschecked 6 objects RMAN> list backupset; using target database control file instead of recovery catalog List of Backup Sets =================== BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 26 Full 320.44M DISK 00:01:03 14-JUN-12 BP Key: 34 Status: AVAILABLE Compressed: YES Tag: TAG20120614T153439 Piece Name: D:\ORACLE\FAST_RECOVERY_AREA\CATDB\BACKUPSET\2012_06_14\O1_MF_NNNDF_TAG201206 14T153439_7XMHL0JL_.BKP List of Datafiles in backup set 26 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 1 Full 3712551 14-JUN-12 D:\ORACLE\ORADATA\CATDB\SYSTEM01.DBF 2 Full 3712551 14-JUN-12 D:\ORACLE\ORADATA\CATDB\SYSAUX01.DBF 3 Full 3712551 14-JUN-12 D:\ORACLE\ORADATA\CATDB\UNDOTBS01.DBF 4 Full 3712551 14-JUN-12 D:\ORACLE\ORADATA\CATDB\USERS01.DBF 5 Full 3712551 14-JUN-12 D:\ORACLE\ORADATA\CATDB\CATMETADATA01.DBF 6 Full 3712551 14-JUN-12 D:\ORACLE\ORADATA\CATDB\UNDO2.DBF BS Key Size Device Type Elapsed Time Completion Time ------- ---------- ----------- ------------ --------------- 27 99.50K DISK 00:00:00 14-JUN-12 BP Key: 35 Status: AVAILABLE Compressed: YES Tag: TAG20120614T153546 Piece Name: D:\ORACLE\FAST_RECOVERY_AREA\CATDB\BACKUPSET\2012_06_14\O1_MF_ANNNN_TAG201206 14T153546_7XMHN2C6_.BKP List of Archived Logs in backup set 27 Thrd Seq Low SCN Low Time Next SCN Next Time ---- ------- ---------- --------- ---------- --------- 1 47 3712495 14-JUN-12 3712583 14-JUN-12 BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 28 Full 9.45M DISK 00:00:02 14-JUN-12 BP Key: 36 Status: AVAILABLE Compressed: NO Tag: TAG20120614T153547 Piece Name: D:\ORACLE\FAST_RECOVERY_AREA\CATDB\AUTOBACKUP\2012_06_14\O1_MF_S_785950547_7X MHN4MH_.BKP SPFILE Included: Modification time: 14-JUN-12 SPFILE db_unique_name: CATDB Control File Included: Ckp SCN: 3712594 Ckp time: 14-JUN-12 BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 29 Full 9.45M DISK 00:00:07 14-JUN-12 BP Key: 37 Status: AVAILABLE Compressed: NO Tag: TAG20120614T162535 Piece Name: D:\ORACLE\FAST_RECOVERY_AREA\CATDB\AUTOBACKUP\2012_06_14\O1_MF_S_785953535_7X MLKN66_.BKP SPFILE Included: Modification time: 14-JUN-12 SPFILE db_unique_name: CATDB Control File Included: Ckp SCN: 3715284 Ckp time: 14-JUN-12 BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 30 Full 9.45M DISK 00:00:02 14-JUN-12 BP Key: 38 Status: AVAILABLE Compressed: NO Tag: TAG20120614T212957 Piece Name: D:\ORACLE\FAST_RECOVERY_AREA\CATDB\AUTOBACKUP\2012_06_14\O1_MF_S_785971797_7X N4D6YF_.BKP SPFILE Included: Modification time: 14-JUN-12 SPFILE db_unique_name: CATDB Control File Included: Ckp SCN: 3735186 Ckp time: 14-JUN-12 BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 31 Full 9.45M DISK 00:00:23 29-JUN-12 BP Key: 39 Status: AVAILABLE Compressed: NO Tag: TAG20120629T162221 Piece Name: D:\ORACLE\FAST_RECOVERY_AREA\CATDB\AUTOBACKUP\2012_06_29\O1_MF_S_787249342_7Y V4001O_.BKP SPFILE Included: Modification time: 29-JUN-12 SPFILE db_unique_name: CATDB Control File Included: Ckp SCN: 5138750 Ckp time: 29-JUN-12
Please do not forget to change the status thread answer whether it is possible when believe you your thread replied, he pretend to wasting time in other forums users while they are looking outstanding which is not answered, thank you for understanding
Published by: Julien Hesenov on July 9, 2012 12:42
-
How to display the result sqlplus in java?
I want to call sqlplus to run some commands sql in java, but how can I print the result of sqlplus?
In java code, I call sqlplus as:
Process of p;
Run the command
p = Runtime.getRuntime () .exec (commandString);
print the result of the command
InputStream inputStream = p.getInputStream ();
How to display the result of the execution?
Published by: Yi on February 26, 2012 23:41You can use ProcessBuilder. Copy the following code starts sql * more and runs the script in the variable "filename". It displays the results in the console of NetBeans.
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.File; import java.util.Map; public class test1 { public static void main (String args []) { test_script(); } public static void test_script () { String fileName = "@test_table.sql"; String sqlPath = "E:\\"; String sqlCmd = "sqlplus"; String arg1 = "user/password@sid"; -- plug in your user, password and db name String arg2 = fileName; try { String line; ProcessBuilder pb = new ProcessBuilder(sqlCmd, arg1, arg2); Map
env = pb.environment(); env.put("VAR1", arg1); env.put("VAR2", arg2); pb.directory(new File(sqlPath)); pb.redirectErrorStream(true); Process p = pb.start(); BufferedReader bri = new BufferedReader (new InputStreamReader(p.getInputStream())); BufferedReader bre = new BufferedReader (new InputStreamReader(p.getErrorStream())); while ((line = bri.readLine()) != null) { System.out.println(line); } bri.close(); while ((line = bre.readLine()) != null) { System.out.println(line); } bre.close(); System.out.println("Done."); } catch (Exception err) { err.printStackTrace(); } } } Here is the content of the script at E:\\test_table.sql
Prompt drop TABLE ANOTHER_TEST; DROP TABLE ANOTHER_TEST CASCADE CONSTRAINTS / Prompt Table ANOTHER_TEST; CREATE TABLE ANOTHER_TEST ( BATCH_SEQ NUMBER, BATCH_GROUP_ID NUMBER, STATUS_FLAG VARCHAR2(30 BYTE), OBJ_BEING_PROCESSED VARCHAR2(80 BYTE), BATCH_RUN_START_DTTM DATE, BATCH_RUN_END_DTTM DATE, CREATE_DTTM DATE, CREATE_USER VARCHAR2(30 BYTE), UPDATE_DTTM DATE, UPDATE_USER VARCHAR2(30 BYTE) ) LOGGING NOCOMPRESS NOCACHE PARALLEL ( DEGREE DEFAULT INSTANCES DEFAULT ) MONITORING / COMMENT ON TABLE ANOTHER_TEST IS 'This is a test table.' / EXIT /
-
How to keep the environment setting
We need to set disable javascript.
But,
after update, it turns to activate.
You please show me
How to keep the environment-setting before and after the update of Adobe reader.
Thank you
JavaScript is enabled by default in the browsers. Turn off (disable) is a manual process, which must be done by the end user.
JavaScript must be enabled in order to use the Adobe Download Manager.
You can download the Installer http://get.adobe.com/reader/enterprise/ offline without having to activate javascript. But there IS NO Adobe Reader (or Adobe Updater) affecting control javascript in browsers, or disable it automatically afer a download.
-
Hey Adobe, could I know how to configure the printer setting in Photoshop CS6 on the Lable print.
Hello
Are you referring to the labels under brands of printing option when you open the print dialog window?
If you check this option button, the name of the file you are editing will be printed on the top of the page, as shown below. You can change this label by changing the name of your file (go in file > save the to do)
If you want to learn more about the print marks, take a look at this help document.
If you try to print actual labels, you will need to use a pre-made template or create your own. Here is a template you can download free Adobe!
If you have any other questions, feel free to post here again
See you soon,.
Kendall
Maybe you are looking for
-
conferences of watchmaking and the blank page
Hi there, im trying to watch the conferences when I click on the link to open a new page need me and it comes in white. This never happened in the past and has only started since the new update of mozilla...
-
I have a predefined XML that contains a large number of tags that need to stay in the correct order. For each new item that I get, I need some of the tags with information now complete and save the XML to a new file by using the name of items. Is the
-
Hello! I have a Toshiba Satellite and I was wondering how to adjust the bass?He can't find anywhere
-
How can I add the icons on the desktop web-based
original title: How can I add icons on the desktop as internet, g mail, shortcuts ect so I see nothing on the upper Office except listn on youtube How to add desktop icons
-
I have upgraded to Windows 10 and have since had problems with the scan from the printer to the PC. In the end, I uninstalled software according to the instructions, but when I tried to install the new software from the HP Support page does not recog