oracle11g

DBMS LOB.SUBSTR Throwing ORA-00904: Invalid Identifier Error

我的梦境 提交于 2020-01-04 11:03:01
问题 One of our cutomer is running the scripts in oracle sql developer to upgrade his database table structure, procudere & triggers etc. But while running the script, he is getting ORA-00904: Invalid Identifier Error for DBMS_LOB.SUBSTR() and DBMS_LOB.GETLENGTH() in one procedure. Can somebody tell why is happening so? There are using Oracle Sql developer Version 3.1.07 Build MAIN-07.42 with Oracle 11g. 回答1: I imagine 3 possible reasons: the user lacks execute privilege on sys.dbms_lob (although

ORA-28113: policy predicate has error

依然范特西╮ 提交于 2020-01-04 07:43:11
问题 I need some help with Oracle's VPD feature. I have never used it before but did some research online about it, however I'm running into a problem. Here are the steps that I have taken: QuanTriDL: create table NhanVien2 table NhanVien2 QuanTriVPD: CREATE OR REPLACE CONTEXT ThongTinTaiKhoan USING TTTK_PKG; CREATE OR REPLACE PACKAGE TTTK_PKG IS PROCEDURE GetTTTK; END; / CREATE OR REPLACE PACKAGE BODY TTTK_PKG IS PROCEDURE GetTTTK AS TaiKhoan varchar(30); tenPhong varchar(30); tenChucVu varchar

Converting dates from different centuries

两盒软妹~` 提交于 2020-01-04 06:43:07
问题 I have staging table which contains date as string with format 'mm/dd/yy'. I have Oracle 11g procedure to convert the string to date format before loading into main table. I'm using to_date('03/20/34','mm/dd/rr') to convert into date format which is giving wrong output as 03/20/2034 whereas the correct date is 03/20/1934. Please help me out to get the correct output where my table contains dates from both centuries. 回答1: "I'm using to_date('03/20/34','mm/dd/rr') to convert into date format

Finding query from oracle which is blocking session

▼魔方 西西 提交于 2020-01-04 05:54:09
问题 I want to find out the query for which any operation is blocked. From DBA I'm getting input that particular session is blocked but I cannot proceed with investigation further without knowing which query is causing issue. is there any way to find out exact query causing issue? 回答1: First get the SQL_ID of the BLOCKING session from this script: SELECT /*+ RULE */ s.sid, s.serial#, p.spid "OS SID", s.sql_hash_value "HASH VALUE", s.username "ORA USER", s.status, s.osuser "OS USER", s.machine, s

How to make CLOB column in group by expression? Any work around?

三世轮回 提交于 2020-01-04 04:32:06
问题 I have a below query: SELECT Test_Case_Name, Test_Case_Description, Test_Case_Status, CASE WHEN Test_Case_Status = 'FAILED' THEN LISTAGG(LN.LN_BUG_ID,', ') WITHIN GROUP(ORDER BY LN.LN_BUG_ID) END AS Defect_ID FROM Test LEFT JOIN LINK LN ON LN.LN_ENTITY_ID=Test.TS_TEST_ID GROUP BY Test_Case_Name, Test_Case_Description, Test_Case_Status When I run this query, I get the error ORA-00932: inconsistent data types Expected got CLOB This is because the column Test_Case_Description is a CLOB data type

How to join two tables based on a timestamp (with variance of a few seconds)?

北战南征 提交于 2020-01-04 01:52:13
问题 I have two tables that I'm trying to join and insert into another table based on a combination of three columns. I'll explain. Table M | ANO | BNO | Timestamp | Duration --------------------------------------------------------------- | 5612853 | 4732621 | 21.11.2013 09:50:58 | 196 | 4842988 | 5610953 | 21.11.2013 17:34:58 | 98 | 7765759 | 5612853 | 21.11.2013 20:48:00 | 377 | 2470321 | 2470263 | 21.11.2013 21:47:18 | 125 Table N | ANO | BNO | Timestamp | Duration -----------------------------

How to add rows into a cursor manually in stored procedure in oracle

心已入冬 提交于 2020-01-04 01:49:20
问题 I have a cursor in stored procedure. I want to select some data from a query and insert that data into cursor, then again select some data from another query and append that data into the same cursor. How can I do this? 回答1: A cursor is a read-only handle for a SQL statement. A cursor has no data. You cannot append data to a cursor. The only thing you can do with a cursor is fetch the next row. You can change the SQL statement that is used to open the cursor to UNION together the two

How to drop columns in a compressed table?

筅森魡賤 提交于 2020-01-03 18:04:50
问题 After compressing a table, it's not possible to drop a column any more: CREATE TABLE foo (p NUMBER, i NUMBER, j NUMBER) COMPRESS BASIC; ALTER TABLE foo DROP COLUMN j; ORA-39726: unsupported add/drop column operation on compressed tables It is possible if advance compression is used: CREATE TABLE foo (p NUMBER, i NUMBER, j NUMBER) COMPRESS FOR OLTP; ALTER TABLE foo DROP COLUMN j; Table FOO altered. However, the column is not really dropped, just hidden: SELECT column_name, data_type, hidden

How to drop columns in a compressed table?

旧时模样 提交于 2020-01-03 18:03:17
问题 After compressing a table, it's not possible to drop a column any more: CREATE TABLE foo (p NUMBER, i NUMBER, j NUMBER) COMPRESS BASIC; ALTER TABLE foo DROP COLUMN j; ORA-39726: unsupported add/drop column operation on compressed tables It is possible if advance compression is used: CREATE TABLE foo (p NUMBER, i NUMBER, j NUMBER) COMPRESS FOR OLTP; ALTER TABLE foo DROP COLUMN j; Table FOO altered. However, the column is not really dropped, just hidden: SELECT column_name, data_type, hidden

collection of records to out sys_refcursor

时间秒杀一切 提交于 2020-01-03 17:02:59
问题 Oracle 11g This seems harder than it should be so I might be on the wrong path here. I have an application that generates user defined forms, my data is a bit more complicated than this but the idea is -- I have a data table which contains all the data input from the user defined forms create table formData( id number , fName varchar(100) , lName varChar(100) , mName varChar(100) , formType varchar(100) ... ); insert all into formData(id,fName,lName,mName,formType)values(1,'Bob','Smith',NULL,