Oracle

Joining multiple rows into a single row without aggregation [Oracle]

佐手、 提交于 2021-01-29 19:34:06
问题 I have the following query: select type, date, amount from table; And it gives the following result: TYPE DATE AMOUNT -------------------------------- A 30.6.2019 15 B 30.11.2019 20 C 22.12.2019 17 What I want to do is write a query that would return the following: TYPE1 DATE1 AMOUNT1 TYPE2 DATE2 AMOUNT2 TYPE3 DATE3 AMOUNT3 ------------------------------------------------------------------------------------------------------ A 30.6.2019 15 B 30.11.2019 20 C 22.12.2019 17 The number of rows

Using a REF CURSOR to retrieve a ResultSet with java program is throwing an error

微笑、不失礼 提交于 2021-01-29 18:33:33
问题 I'm trying to follow this guide in order to retrieve a result set from a stored procedure. The stored procedure (Oracle 12c) : CREATE OR REPLACE PROCEDURE GetLastActions ( p_actions IN OUT SYS_REFCURSOR ) IS BEGIN OPEN p_actions FOR SELECT ACTION_ID, ACTION_DATE FROM ACTIONS FETCH NEXT 10 ROWS ONLY; END; The call in Java (I'm using JDK 1.6) : String qLoadTmpData = "{call GetLastActions(?)}"; Connection con; try { Connection con = getConnection(); con.setAutoCommit(false); CallableStatement

Number format issue in Oracle

跟風遠走 提交于 2021-01-29 18:21:59
问题 So i have created a test table having a number column which is of the data type Number(11,8) . Now when i am trying to insert the value 13332 in the table it is throwing an oracle error saying: ORA-01438: value larger than specified precision allowed for this column I am not sure why. The same works when i am inserting into a column with data type Number(12,6) INSERT INTO MY_TABLE(COLUMN_1) values('13332'); 回答1: The reason is - out of 11 digits you have specified 8 digits after decimal places

Use of undefined constant OCI_CRED_EXT - assumed 'OCI_CRED_EXT' laravel

99封情书 提交于 2021-01-29 18:21:04
问题 I'm trying to connect oracle database to my laravel application using this package: https://github.com/yajra/laravel-oci8 but having error with the external connection, this is the error: Here the line of error in package: https://github.com/yajra/laravel-oci8/blob/5.8/src/Oci8/Connectors/OracleConnector.php#L35 System details Operating System: macOS Mojave Version 10.14.4 (18E226) PHP Version: 7.3 Laravel Version: 5.8.* Laravel-OCI8 Version: 5.8.* Anyone can help me please? 回答1: Looks like

Avoiding frequent call to same view inside a Oracle procedure

僤鯓⒐⒋嵵緔 提交于 2021-01-29 18:11:40
问题 I have a oracle view it returns 5 million records from different tables and i use this view to insert into different tables using a single procedure, inside this procedure i use this several times and this is affecting the performance, is there any way we can query the view once and later i can use it multiple places? 回答1: A view is a stored query; itself, it doesn't contain any data. If its code is complex and fetches data from several tables, using different conditions, aggregations,

Convert Oracle CLOB data to string in c#

橙三吉。 提交于 2021-01-29 18:09:08
问题 I am trying to run the below query which returns a DataTable object in C#. select TO_CLOB(BLOB) FROM TestBlobData where BSIZE=5000 When I try to extract the value out of datatable object, a junk value is seen. DataTable dataTable = RunQuery(QueryMentionedAbove); var str = dataTable.Rows[0]["BLOB"].ToString(); When I look at Str , I could not see the converted string. The BLOB is actually a JSON string. I cannot use TO_CHAR or TO_NCHAR because my blob size will be greater than 4000. My

Comparing 2 text fields SQL - Error- ORA-22835: Buffer too small for CLOB to CHAR or BLOB to RAW conversion

旧巷老猫 提交于 2021-01-29 18:04:47
问题 I have seen quite of this same error with different solutions on the web, but none seem to solve what I am trying to do. I want to compare 2 text fields: PROBLEMCODE and DESCRIPTION. The text is contained in CLOB and BLOB objects some of which are ~24000 bytes (CHARs?) which throws the error: ORA-22835: Buffer too small for CLOB to CHAR or BLOB to RAW conversion (actual: 4029, maximum: 4000) I fully understand the root cause of this error, but I do not understand how to work around it

implicit inner joins - are they equal?

橙三吉。 提交于 2021-01-29 18:00:20
问题 In my opinion these two SELECTs are exactly equal (but I want to rewrite the first for the second to help the optimizer in my case) - whatever data sits in tables a,b,c,d both SELECTs will produce exactly the same results. Do you agree? Thanks! create table a (id number); create table b (id number); create table c (id number); create table d (id number); --Q1 select * from a,b,c,d where a.id = b.id and a.id = c.id and a.id = d.id; --Q2 select * from a,b,c,d where a.id = b.id and a.id = c.id

How to sort texts with '_' in Oracle exactly like EXCEL?

岁酱吖の 提交于 2021-01-29 17:48:58
问题 In Excel When I sort the texts in ascending order, results shows as below. Text with the underscore character precedes the others. And in Excel cell, when I type in ="_" < "A", then "True" shows as expected. C10_ C10A C20_ C20A But, In Oracle, when I sort in ascending order, results shows as below. (I guess, Oracle treats '_' < 'A' False) C10A C10_ C20A C20_ How can I make Oracle sort the list exactly as Excel does? I have changed ASC to DESC, but the result was not what I expect. My sorting

Update statment using vb.net to update all fields

家住魔仙堡 提交于 2021-01-29 17:34:22
问题 I create table using sql developer create table tablenodes ( nodeNo int , nodeName varchar2(50), centerX int , centerY int, radius number(7,2), fileNo int ) And I want to update all fields in this table, so I wrote the following code: Friend Function UpdateNodeToTable(ByVal FN As Integer, ByVal nd As classNode) As Boolean Try Dim con As New OracleConnection con.ConnectionString = "Persist Security Info=False;User ID=manal;password=manal;Data Source=xe" con.Open() Dim cmd As New OracleCommand