oracle11g

Rename column named TYPE, LEVEL in sqlplus

我们两清 提交于 2019-12-25 04:51:13
问题 This needs to be done in sql plus. Hi, I'm struggling to rename two columns in my table. They are named "TYPE" and "LEVEL". This needs to be done in sql plus with no exception. The following does not work (works in sql developer tho): alter table client rename column level to clevel; alter table client rename column "level" to clevel; 回答1: LEVEL is an Oracle keyword , though not reserved. If you want to use it as an object name then you need to represent the name of an object with a quoted

how to update multiple tables in oracle DB?

跟風遠走 提交于 2019-12-25 04:47:19
问题 i am using two tables in my oracle 10g. the first table having the keyword,count,id(primary key) and my second table having id, timestamp.. but i am doing any chages in the first table(keyword,count) it will reflect on the my second table timestamp.. i am using id as reference for both the tables... table1: CREATE TABLE Searchable_Keywords (KEYWORD_ID NUMBER(18) PRIMARY KEY, KEYWORD VARCHAR2(255) NOT NULL, COUNT NUMBER(18) NOT NULL, CONSTRAINT Searchable_Keywords_unique UNIQUE(KEYWORD) );

Generate Sequence of dates and time

爷,独闯天下 提交于 2019-12-25 04:46:15
问题 Is it possible to change this query below so that instead of the "OPEN" being the same it would be the LAST "INTERVALENDTIME". Unless of course it is a new day then it would be "OPEN" For example here are a few lines of date from the current version: DT OPEN CLOSE NAME INTERVAL END 8/4/2015 8/4/2015 9:00:00 AM 8/4/2015 2:00:00 PM Bob 8/4/2015 1:00:00 PM 8/4/2015 8/4/2015 9:00:00 AM 8/4/2015 2:00:00 PM Bob 8/4/2015 2:00:00 PM 8/5/2015 8/5/2015 9:00:00 AM 8/5/2015 2:00:00 PM Bob 8/5/2015 10:00

Using a pl-sql procedure or cursor to select top 3 rank

亡梦爱人 提交于 2019-12-25 04:38:37
问题 Can someone please tell how can I get the results as below. Using dense_rank function where rank <=2 will give me top 2 offers. I am also looking to get 'total_offer' which should be sum of 'offer1' and 'offer2'. when there is no offer2 ( eg:taurus) 'total offer' should be 'offer1' and 'null' for 'offer2' Input: customer make zipcode offer mark focus 101 250 mark focus 101 2500 mark focus 101 1000 mark focus 101 1500 henry 520i 21405 500 henry 520i 21405 100 henry 520i 21405 750 henry 520i

Loading external files into oracle database

吃可爱长大的小学妹 提交于 2019-12-25 04:22:44
问题 I have created the below table. create table emps( id varchar2(20), clobi clob); Am trying to insert bfile into the COLBI column using the below procedure: create or replace procedure bfii is bfil bfile; clo clob; begin insert into emps values('3',empty_clob() ) returning clobi into clo; bfil := bfilename('clobr', 'Man.ext'); dbms_lob.fileopen(bfil); dbms_lob.loadfromfile(clo,bfil, dbms_lob.getlength(bfil)); dbms_lob.fileclose(bfil); end; But I'm getting the error message at run-time rather

Is Schema in Oracle is equivalent to Database in Microsoft SQL Server?

偶尔善良 提交于 2019-12-25 04:15:42
问题 I am new to Oracle database and I wanted to create a database in Oracle. I followed this link to create a database: http://www.fehily.com/books/createdb/createdb_oracle_11g_2.html In Microsoft SQL Server, when we create a database, we use the create database command and the database creation is instantaneous [within fraction of seconds], but the Database Tool as described in link above took couple of minutes to create the database. Is database creation in Oracle this much slower? Searching

How do I create an Oracle table of objects containing nested tables?

给你一囗甜甜゛ 提交于 2019-12-25 03:57:34
问题 My question is similar to 9454933 but my nested table is within the object. I wish to create a table of user defined types where the defined type contains an object, my simplified setup looks like this CREATE TYPE DEMO_TYPE1 AS OBJECT (A1 NUMBER, A2 NUMBER); CREATE TYPE DEMO_TAB_TYPE1 AS TABLE OF DEMO_TYPE1; CREATE TYPE DEMO_TYPE2 AS OBJECT (B1 NUMBER, B2 DEMO_TAB_TYPE1); CREATE TABLE DEMO_TAB1 (C1 NUMBER, C2 DEMO_TYPE2); If I run the above I get the following error The storage clause is not

Convert rows into columns Oracle

你说的曾经没有我的故事 提交于 2019-12-25 03:29:24
问题 This has been asked several times and has been answered as many times, but this is different because: this is in Oracle 11g - other examples I have seen are in SQL Server with StUFF function This requires joining 2 tables to get the info Let me explain This is the table that holds field names & File_ID CREATE TABLE RESPONSE_METADATA ( FILE_ID NUMBER(10) NOT NULL, FIELD_NUMBER NUMBER(4) NOT NULL, FIELD_NAME VARCHAR2(50 BYTE) NOT NULL, FIELD_TYPE VARCHAR2(50 BYTE) NOT NULL ); This is a table

Convert rows into columns Oracle

孤街浪徒 提交于 2019-12-25 03:29:05
问题 This has been asked several times and has been answered as many times, but this is different because: this is in Oracle 11g - other examples I have seen are in SQL Server with StUFF function This requires joining 2 tables to get the info Let me explain This is the table that holds field names & File_ID CREATE TABLE RESPONSE_METADATA ( FILE_ID NUMBER(10) NOT NULL, FIELD_NUMBER NUMBER(4) NOT NULL, FIELD_NAME VARCHAR2(50 BYTE) NOT NULL, FIELD_TYPE VARCHAR2(50 BYTE) NOT NULL ); This is a table

Use static or context sensitive VPD policies to limit table access of a specific user?

限于喜欢 提交于 2019-12-25 02:56:15
问题 Let's assume there are two database users: (1) A user named APP who connects to the database very often and queries and modifies many tables in his own schema. (2) A user named WEB who only connects to the database rarely and only queries and modifies a few tables in the APP schema. I need to limit the table access of both users depending on the data. I'm using the Oracle Virtual Private Database (VPD) feature (sometimes also known as fine-grained access control) to do this. For this question