oracle11g

Return one variable from a SELECT inside a function

老子叫甜甜 提交于 2019-12-11 17:31:24
问题 I'm trying to create a function that return a varchar, one of the fields form a select, the aggregation field. I'm getting the next error: ORA-01422: exact fetch returns more than requested number of rows What I understand is that the select produce more than one row before aggregating and this triggers the error when trying to put them 'into k, s, categories' Here is the function: FUNCTION get_cat(kind_id IN varchar, system_id IN Number) RETURN VARCHAR2 AS categories VARCHAR2(2000); k

Unique constraint without index

社会主义新天地 提交于 2019-12-11 17:08:47
问题 let's say I have a large table. This table not need to be queried, I just want to save the data inside for a while. I want to prevent duplicates rows in the table, so I want to add an unique constraint (or PK) on the table. But the auto-created unique index is realy unnecessary. I don't need it, and it's just wasting space in disk and require a maintenance (regardless of the long time to create it). Is there a way to create an unique constraint without index (any index - unique or nonunique)?

ORA-01591 - oracle delete data from remote sql server table

风格不统一 提交于 2019-12-11 16:57:39
问题 Using a heterogenous connection from Oracle 11gr2 to Sql Server 2005, we are trying to fetch data. While fetching in a loop, if we don't commit after inserting the data to Oracle, and try to delete the data at Sql Server this error occurs : ORA-01591: kilit belirsiz dağıtılmış 3.10.5910 işlemi tarafından tutuluyor This problem keeps on going until re-creating the table. We would be very happy to hear if any logical, humanistic approach exists? 回答1: the real answer is at http://download.oracle

Oracle - runtime and show data based on inserted year ( not duplicate )

做~自己de王妃 提交于 2019-12-11 16:56:48
问题 FacilityTable FACILITYNO FACILITYNAME 'FACNO01' Toilet 'FACNO02' Staff Office 'FACNO03' Principle Office 'FACNO04' Science Lab 'FACNO05' Math Lab 'FACNO06' Computer Lab 'FACNO07' Biology Lab 'FACNO08' Chemical Lab BookingTable FACILITYNO bookingID userID Timebooked 'FACNO01' 1 0003 10-May-2016 'FACNO04' 2 0001 10-May-2018 'FACNO05' 3 0001 10-Apr-2017 'FACNO01' 4 0001 10-Apr-2017 'FACNO02' 5 0003 10-Jan-2011 'FACNO04' 6 0006 10-Apr-2018 'FACNO06' 7 0003 10-Apr-2016 'FACNO07' 8 0006 10-Apr-2015

Oracle Sql - retrieve distinct data from a listagg [duplicate]

余生长醉 提交于 2019-12-11 16:53:58
问题 This question already has answers here : LISTAGG in Oracle to return distinct values (23 answers) Closed last year . With this command I'm able to retrieve a count of all the distinct manager_id grouped by department_id select department_id, count( distinct manager_id) from employees group by department_id If I want to see a list of those managers, I can use this but the problem is that they are repeated and not distinct select department_id, listagg(manager_id, ' | ') within group(order by

Creating and calling PL/SQL functions

风格不统一 提交于 2019-12-11 16:51:53
问题 I'm new to PL/SQL. It's been on fine until now that is. I've the query this query which works fine. declare rec employees_practice%rowtype; sam taxObligations%rowtype; socialsecurity number; rentallowance number; transportation number; taxableincome number; incometaxliability number; netpay number; total number; totaldeductions number; begin for rec in (select * from employees_practice) loop socialsecurity:=(5.5/100)*(rec.salary); rentallowance:=(20/100)*(rec.salary); if(rec.Category='S')

Generating XML PLSQL Iterative

做~自己de王妃 提交于 2019-12-11 16:23:43
问题 I am trying to build some very large XML files via PL/SQL in Oracle 11g. I am trying to build the files iteratively - fetch one row, write to file, get next row, etc. Below is my code. I am having issues on where to define the CLOB. I get two errors depending on where I initialize and free the CLOB: 1-Exceeding memory -- when initializing CLOB before loop and freetemporary after loop 2- Can't find the clob(invalid LOB locator specified) -- when initialize in loop and free in loop, or

remove extra + from text SQL

跟風遠走 提交于 2019-12-11 15:57:42
问题 this refers to a question asked by someone else previously previous question my question is how do I adapt this solution so that before any function/script is ran the name and value fields are stripped of any additional + and updated so no additional + remain. For e.g. Name Value A+B+C+ 1+2+3+ A++B 1++2 this should be updated to Name Value A+B+C 1+2+3 A+B 1+2 once this update has taken place, I can run the solution provided in the previous question. Thanks 回答1: You need to replace ++ with +

General error: 1008 OCIStmtExecute: ORA-01008: not all variables bound

岁酱吖の 提交于 2019-12-11 15:56:12
问题 I'm doing a login window and when I count the number of rows affected by the SELECT statement to validate the account and the password I have a problem. Error: SQLSTATE[HY000]: General error: 1008 OCIStmtExecute: ORA-01008: not all variables bound (ext\pdo_oci\oci_statement.c:159) Here is the problem (I did this because I need count number of rows when i do SELECT. All this is to login.) I found this piece of code in Official page of PHP: Page PHP link (Example number 2) $resultado = $base-

Best way to receive an email after concurrent failed (sql - trigger - application)

我与影子孤独终老i 提交于 2019-12-11 15:51:50
问题 I want to receive an email if the concurrent execution endded up with an error; Take a look: i have a query which contains the latest execution of a concurrent (i am using Oracle 11g): select * from ( select yer.user_murcurrent_program_yere program, mur.request_id "request id", mur.status_code status, row_number() over (partition by yer.user_murcurrent_program_yere order by mur.request_id desc ) as rn from fnd_murcurrent_programs_tl yer join fnd_murcurrent_requests mur on mur.murcurrent