oracle11g

ORA 12514 error:TNS listener error

假装没事ソ 提交于 2020-01-01 16:32:25
问题 Ok everything worked fine till yesterday now i am suddenly getting this error ORA-12514: TNS:listener does not currently know of service requested in connect descriptor nothing had been modified XE = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = jainam-2b1c493d)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = XE) ) ) EXTPROC_CONNECTION_DATA = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1)) ) (CONNECT_DATA = (SID = PLSExtProc) (PRESENTATION =

Oracle UpdateXML() changes XML structure?

本秂侑毒 提交于 2020-01-01 14:26:07
问题 When I call UpdateXML() I find that empty nodes are being converted to shorthand XML. Is there a way to prevent UpdateXML() from behaving this way, perhaps a flag or setting or alternate XPath expression to tell it to preserve the original structure? /* Example 1 */ SELECT UpdateXML(xmlData, '/TEST/VALUE/text()', 'hello') as "Example 1" FROM (SELECT XMLType('<TEST><VALUE>hi</VALUE></TEST>') as xmlData FROM DUAL); Example 1 --------- <TEST><VALUE>hello</VALUE></TEST> /* Example 2 */ SELECT

PLSQL generate random integer

我们两清 提交于 2020-01-01 03:37:21
问题 In Oracle Sql developer 11g, how do I generate a random integer and assign it to a variable? This is what I've tried so far: S_TB := SELECT dbms_random.value(1,10) num FROM dual; With this code I got error: S_TB := SELECT dbms_random.value(1,10) num FROM dual Error report - Unknown Command What is the proper way to solve my issue? 回答1: Variables require PL/SQL; it's not clear from your question whether your code is a proper PL/SQL block. In PL/SQL variables are populated from queries using

LISTAGG equivalent with windowing clause

天涯浪子 提交于 2020-01-01 02:33:10
问题 In oracle, the LISTAGG function allows me to use it analytically with a OVER (PARTITION BY column..) clause. However, it does not support use of windowing with the ROWS or RANGE keywords. I have a data set from a store register (simplified for the question). Note that the register table's quantity is always 1 - one item, one transaction line. TranID TranLine ItemId OrderID Dollars Quantity ------ -------- ------ ------- ------- -------- 1 101 23845 23 2.99 1 1 102 23845 23 2.99 1 1 103 23845

How to test connection to Oracle Database using Java

我是研究僧i 提交于 2019-12-31 13:48:27
问题 Is there a way to test my connection to oracle database using Java? Here's my code. public class OracleConnection { public static void main(String[] args) throws Exception { //connect to database Class.forName("oracle.jdbc.driver.OracleDriver"); String serverName = "00.000.0.000"; String portNumber = "1521"; String sid = "My Sid"; String url = "jdbc:oracle:thin:@" + serverName + ":" + portNumber + ":" + sid; String username = "UNAME"; String password = "PASSWORD"; Connection conn =

Selecting both MIN and MAX From the Table is slower than expected

杀马特。学长 韩版系。学妹 提交于 2019-12-31 11:33:51
问题 I have a table MYTABLE with a date column SDATE which is the primary key of the table and has a unique index on it. When I run this query: SELECT MIN(SDATE) FROM MYTABLE it gives answer instantly. The same happens for: SELECT MAX(SDATE) FROM MYTABLE But, if I query both together: SELECT MIN(SDATE), MAX(SDATE) FROM MYTABLE it takes much more time to execute. I analyzed the plans and found when one of min or max is queried, it uses INDEX FULL SCAN(MIN/MAX) but when both are queried at the same

Selecting both MIN and MAX From the Table is slower than expected

社会主义新天地 提交于 2019-12-31 11:33:33
问题 I have a table MYTABLE with a date column SDATE which is the primary key of the table and has a unique index on it. When I run this query: SELECT MIN(SDATE) FROM MYTABLE it gives answer instantly. The same happens for: SELECT MAX(SDATE) FROM MYTABLE But, if I query both together: SELECT MIN(SDATE), MAX(SDATE) FROM MYTABLE it takes much more time to execute. I analyzed the plans and found when one of min or max is queried, it uses INDEX FULL SCAN(MIN/MAX) but when both are queried at the same

Selecting both MIN and MAX From the Table is slower than expected

为君一笑 提交于 2019-12-31 11:33:06
问题 I have a table MYTABLE with a date column SDATE which is the primary key of the table and has a unique index on it. When I run this query: SELECT MIN(SDATE) FROM MYTABLE it gives answer instantly. The same happens for: SELECT MAX(SDATE) FROM MYTABLE But, if I query both together: SELECT MIN(SDATE), MAX(SDATE) FROM MYTABLE it takes much more time to execute. I analyzed the plans and found when one of min or max is queried, it uses INDEX FULL SCAN(MIN/MAX) but when both are queried at the same

How to find the users list in oracle 11g db?

冷暖自知 提交于 2019-12-31 08:14:20
问题 How to find out the users list, which is all created in the oracle 11g database. Is there any command to find out the users list which we can execute from the Command line interface! 回答1: I am not sure what you understand by "execute from the Command line interface", but you're probably looking after the following select statement: select * from dba_users; or select username from dba_users; 回答2: select * from all_users This will work for sure 回答3: The command select username from all_users;

How to join 2 queries with different number of records and columns in oracle sql?

我只是一个虾纸丫 提交于 2019-12-31 07:48:10
问题 I have three tables: Employee_leave(EmployeeID,Time_Period,leave_type) Employee(EID,Department,Designation) leave_eligibility(Department,Designation, LeaveType, LeavesBalance). I want to fetch the number of leaves availed by a particular employee in each LeaveTypes(Category) so I wrote following query Query1 SELECT LEAVE_TYPE, SUM(TIME_PERIOD) FROM EMPLOYEE_LEAVE WHERE EMPLOYEEID=78 GROUP BY LEAVE_TYPE order by leave_type; output for Query1 Leave_Type | SUM(Time_Period) Casual 1 Paid 4 Sick 1