oracle11g

How to sort a same column both in asc order and desc order

孤者浪人 提交于 2019-12-11 02:49:42
问题 With an SQL Query how do we get the output of 2 columns, the first one being a column sorted in asc order and the second one with the order desc and both are same columns. ex: emp table: empid 1 5 9 4 The query output should be empid_1 empid_2 1 9 4 5 5 4 9 1 What OP tried so far WITH emp1 AS (SELECT ROWNUM a, empno FROM (SELECT empno FROM emp ORDER BY 1 ASC)), emp2 AS (SELECT ROWNUM b, empno FROM (SELECT empno FROM emp ORDER BY 1 DESC)) SELECT emp1.empno, emp2.empno FROM emp1, emp2 WHERE

Update Query - Oracle

浪尽此生 提交于 2019-12-11 02:49:25
问题 I am not able to understand the issue with the following SQL query. I am trying to copy column ABC from table TABLE3 to TABLE1 with TABLE2 having the common column between the two. UPDATE TABLE1 CS SET CS.ABC = TC.ABC WHERE CS.COMMON_COLUMN = ( SELECT CGL.COMMON_COLUMN FROM TABLE2 CGL, TABLE3 TC WHERE CGL.PRD_ID = TC.PRD_ID AND CGL.PRD_VER = TC.PRD_VER AND CGL.PY_ID = TC.PY_ID AND CGL.TPY_ID = TC.TPY_ID ) I am running into the error: SQL Error: ORA-00904: "TC"."ABC": invalid identifier 00904.

PIVOT Oracle - transform multiple row data to single row with multiple columns, no aggregate data

浪子不回头ぞ 提交于 2019-12-11 02:44:16
问题 I have a need to transfer the following data set: in which only the highlighted lines are the one of interest (Tag in ('LN','SN')) as I am only interested in SerialNumber and LotNumber of the products. I would like to convert the data set above into the following data set: Where it lists the product along with its serialnumber and lot number in 1 row. After doing some reading online, I think PIVOT might be what I need. However, I am struggling with the technical side of the statement. I have

ORA-02391: exceeded simultaneous SESSIONS_PER_USER limit

旧时模样 提交于 2019-12-11 02:39:02
问题 I'm logging in remotely to my school's oracle server. Apparently I've exceeded the number of simultaneous connections and get the error ORA-02391: exceeded simultaneous SESSIONS_PER_USER limit I don't have admin privileges. Does anyone know how I can end my current sessions without admin privileges? 回答1: You don't tell us what sql client you are using. You can only end sessions started from your machine by stopping the client processes. But this could result in idle sessions that are not

java.sql.SQLException: ORA-01461: can bind a LONG value only for insert into a LONG column

杀马特。学长 韩版系。学妹 提交于 2019-12-11 02:24:29
问题 I am using a simple interface (in jsf 1.2 and rich faces 3.3.2, Oracle 11g R1) to let user select picture with rich:fileUpload and save in a table. As a test, i created following table. CREATE TABLE TEST ( MIME_TYPE VARCHAR2 (1000), PHOTO BLOB, STUDENT_ID NUMBER NOT NULL ) code snippet to save the picture to BLOB field is as follows. //......From the uploadFile Listener public void listener(UploadEvent event) throws Exception { ... item = event.getUploadItem(); ... StudentPhotoDAO dao = new

how to convert YYYYMMDD to DD-Mon-YYYY in oracle?

落爺英雄遲暮 提交于 2019-12-11 02:17:40
问题 I am trying to convert the date from YYYYMMDD to DD-Mon-YYYY in Oracle, but to_char or to_Date is not working. Can you please advise? select to_date(20150324,'DD-Mon-YY') from dual; select to_char(20150324,'DD-Mon-YY') from dual; I get an error message saying: - ORA-01861: literal does not match format string 回答1: Use this combination of to_char and to_date : select to_char (to_date('20150324','YYYYMMDD'), 'DD-Mon-YY') from dual; Your mistake was, that you used the wrong date pattern.

Dialog Box not open with GET_FILE_NAME Oracle Forms

不问归期 提交于 2019-12-11 01:56:01
问题 I have oracle database 11g with oracle forms and reports 11g. I created browse button to open CSV File from computer or laptop directory I am using this code on trigger when-button-press: declare filename varchar2(500); begin filename := GET_FILE_NAME(File_Filter=> ‘CSV Files (*.Csv)|*.Csv|’); :block2.FILE_NAME:= filename; end; When I pressed the button then did not open dialog box. 回答1: Your code works on Forms 6i provided you have properly attached the .olb and .pll files for webutil , but

getting error Invalid Oracle URL specified: OracleDataSource.makeURL

大城市里の小女人 提交于 2019-12-11 01:55:01
问题 I am getting error when I try to run my application on Server. I am suing eclipse and glass fish server 4. I made a glassfish-resources.xml file and put it in the WEB-INF directory. When I try to run on server. I get the following exception Internal Exception: java.sql.SQLException: Error in allocating a connection. Cause: Connection could not be allocated because: Invalid Oracle URL specified: OracleDataSource.makeURL Error Code: 0 at org.eclipse.persistence.exceptions.DatabaseException

oracle row contention causing deadlock errors in high throughtput JMS application

穿精又带淫゛_ 提交于 2019-12-11 01:49:01
问题 Summary: I am interested in knowing what's the best practice for high throughput applications that have bulk messages trying to update the same row and get oracle deadlock errors. I know you cannot avoid those errors but how do you recover from them gracefully without getting bogged down by such deadlock errors happening over and over again. Details: We are building a high throughput JMS messaging application. Production environment will be two weblogic 11g nodes (running 6 MDB listener

Explain unexpected regexp_replace result

我们两清 提交于 2019-12-11 01:45:25
问题 I found an unexpected result when using regexp_replace to concatenate a string on the end of another string, as an exercise in using regexp_replace to do it. I bring it up to not only figure out why, but to let folks know of this possibly unexpected result. Consider this statement where the intent is to tack "note 2" on the end of string "Note 1". My intention was to group the entire line, then concatenate the new string to the end: select regexp_replace('note 1', '(.*)', '\1' || ' note 2')