oracle11g

How to implement this trigger on Oracle SQL?

自古美人都是妖i 提交于 2020-01-07 08:12:57
问题 I have found an exercise in the SQL book I study, which is not solved and I can not solve it. The goal is to implement a trigger that avoids overlapping contracts. If a customer with a current contract signs a new one, the end date of the previous one will be one day before the new start date. Tables given are: CREATE TABLE CLIENTS ( clientId VARCHAR2(15), DNI VARCHAR2(9), name VARCHAR2(100) NOT NULL, surname VARCHAR2(100) NOT NULL, sec_surname VARCHAR2(100), eMail VARCHAR2(100) NOT NULL,

How to insert a picture into BLOB column in Oracle table using INSERT syntax?

試著忘記壹切 提交于 2020-01-07 07:49:32
问题 I have a simple table where I want to insert an image that exists on my machine.I would like to insert the picture into my table's BLOB column. Just wondering how can I do it. I understand that there are some existing solutions which are related to BLOB but none have helped me directly by using INSERT SYNTAX. CREATE TABLE test(id int,photo BLOB); INSERT INTO test VALUES(1,'Path of the picture\filename'); 回答1: First of all, create a directory to store images and grant read, write permission to

How to create cluster index in Oracle

元气小坏坏 提交于 2020-01-07 07:44:13
问题 I search many links on google to find out how to create cluster index in oracle but none were satisfactory in explaining. Can anybody please explain how to achieve this in oracle. 回答1: An equivalent to a SQL Server Cluster Index in Oracle would be an Index Organized Table. Here is some info: http://use-the-index-luke.com/sql/clustering/index-organized-clustered-index 来源: https://stackoverflow.com/questions/37610771/how-to-create-cluster-index-in-oracle

How to call an Oracle procedure w/ OUT parameter in WSO2ESB?

送分小仙女□ 提交于 2020-01-07 05:49:06
问题 versions: - WSO2 4.6.0 - Oracle 11g I Have this procedure in an Oracle DB: PROCEDURE SEARCHCONTRACT ( CONTRACTNUM IN OKC_K_HEADERS_B.CONTRACT_NUMBER%TYPE , cur_out IN OUT RefCursor) .... The procedure is working fine! Note that cur_out IN OUT RefCursor ! I have no clue on how to handle that parameter in a DBLookup mediator! This mediator does not have any place to inform whether each parameter is "IN" or "OUT" and I'm not sure if setting the direction (IN/OUT) would be enough. Thanks in

SQL sum 2 different column by different condtion then subtraction and add

雨燕双飞 提交于 2020-01-07 05:40:51
问题 what I am trying is kind of complex, I will try my best to explain. I achieved the first part which is to sum the column by hours. example ID TIMESTAMP CUSTAFFECTED 1 10-01-2013 01:00:23 23 2 10-01-2013 03:00:23 55 3 10-01-2013 05:00:23 2369 4 10-01-2013 04:00:23 12 5 10-01-2013 01:00:23 1 6 10-01-2013 12:00:23 99 7 10-01-2013 01:00:23 22 8 10-01-2013 02:00:23 3 output would be Hour TotalCALLS CUSTAFFECTED 10/1/2013 01:00 3 46 10/1/2013 02:00 1 3 10/1/2013 03:00 1 55 10/1/2013 04:00 1 12 10/1

Oracle SQLPlus ORA-01017 invalid credentials when specifying schema

╄→гoц情女王★ 提交于 2020-01-07 04:43:07
问题 On an Oracle11g database, this works: SQL> connect USER/pass Connected. However, this doesn't: SQL> connect USER/pass@db ERROR: ORA-01017: invalid username/password; logon denied I have executed: SQL> grant connect to USER; Grant succeeded. What am I missing? tnsnames.ora: DB = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = a.dom.b.com)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = db) ) ) EDIT: :> sqlplus USER/pass SQL*Plus: Release 11.1.0.7.0 - Production on Mon Mar

creating a random blob in jdbc and writing it to oracle

微笑、不失礼 提交于 2020-01-07 04:41:35
问题 I want to create many blobs in java [in memory] and write it to Oracle table. What I want is the blob[bits inside it] to be random or sudo random so that oracle would not be able to do a lot of pre-optimization while storing the blob to the table. Something like for(1..1000000) { blob = createRandomBlob(sizeOfBlob); sqlText ="INSERT INTO test_blob (id, blob) VALUES(i, blob)"; stmt.executeUpdate(sqlText); } Can someone point what JAVA APIs I can use to create such blob[in memory rather than on

Adding Time in HH:MM Format -SQL Query

我们两清 提交于 2020-01-07 04:39:04
问题 Sir/Mam, I am using Oracle 11g.I have the following table by the name "Timeduration". It contains time specified in hours and minutes.I want to get the total time in hour and minutes. Timeduration 05:37 06:40 03:45 02:50 07:58 I want the total time as 25:30. How can i write the code for this?? Please help me out." 回答1: with t as ( select '05:37' as timeduration from dual union all select '06:40' as timeduration from dual union all select '03:45' as timeduration from dual union all select '02

Trigger updating clob error

青春壹個敷衍的年華 提交于 2020-01-07 04:27:34
问题 Trying to create a trigger that will update a clob field to rtrim hard returns the application is tossing in. Cannot get to the application code, so I see no other way to make potentially needed changes to the data with a trigger. The returns are not always added. This code is throwing error .... Inconsistent data type expected got clob. I thought declaring the field would avoid the issue... but no... Any help or suggestions greatly appreciated. CREATE OR REPLACE TRIGGER AI_master_set AFTER

PLS-00103: Encountered the symbol “END” when expecting + & = etc

最后都变了- 提交于 2020-01-07 01:48:11
问题 This is my code: DECLARE v_grade CHAR(1) := UPPER('&grade'); appraisal VARCHAR(20); BEGIN appraisal := CASE v_grade WHEN 'A' THEN 'Excellent' WHEN 'B' THEN 'Very Good' WHEN 'C' THEN 'Good' WHEN 'No such grade' END; DBMS_OUTPUT.PUT_LINE('Grade: '||v_grade||'Appraisal '||appraisal); END; / this is the full error code: ERROR at line 10: ORA-06550: line 10, column 1: PLS-00103: Encountered the symbol "END" when expecting one of the following: * & = - + < / > at in is mod remainer not rem then <an