oracle11g

Find numeric subtype (smallint, int, etc) in oracle

不羁岁月 提交于 2019-12-11 07:29:25
问题 I added a table in oracle in oracle with fields - smallint int bigint But it internally store them as decimal(22,0) Is there any way to get individual subtype ( e.g. smallint ) instead of decimal. My usecase: I am using sqoop to copy data from oracle to hive. I need to check metadata of columns of oracle table and wrote own oracle to hive data type mapping. But I am always getting decimal(22,0) , so I need to map all these columns to decimal(22,0) in hive table even for smallint. 回答1: The

Find Correctly Answered Questions in an Online Test with Single and Multi Choice Questions

南笙酒味 提交于 2019-12-11 07:28:49
问题 See the tables : http://dl.dropbox.com/u/10356431/Shared/screen.png Please help me to construct a SQL to find the correctly answered questions in an online test for a particular test_id. I have constructed one. SELECT COUNT(UNIQUE d.question_id) AS CORRECT FROM test_response d, question_response r WHERE d.response_id = r.question_resp_id AND r.correct_response_flag != 'N' AND d.test_id = '10113' But the problem is while it will find the single choice questions accurately, it won't if its a

How to remove specific value from comma separated string in oracle

久未见 提交于 2019-12-11 07:00:26
问题 I want remove specific value from comma separated sting using oracle. Sample Input - col 1,2,3,4,5 Suppose i want to remove 3 from the string. Sample Output - col 1,2,4,5 Please suggest how i can do this using oracle query. Thanks. 回答1: Here is a solution that uses only standard string functions (rather than regular expressions) - which should result in faster execution in most cases; it removes 3 only when it is the first character followed by comma, the last character preceded by comma, or

not able to see oracle services in windows services after upgrading to win 8.1

心不动则不痛 提交于 2019-12-11 06:54:23
问题 I had oracle 11g database installed on my machine (OS win8). It was working fine. This week I upgraded my laptop from win 8 to 8.1. Now I am not able see oracle database services in windows services. Consequently I am not able to start oracle and connect to DB. Tried couple of things like >oradim -STARTUP -SID ORCL DIM-00011: The specified service does not exist. O/S-Error: (OS 1060) The specified service does not exist as an installed servic e. Is there any way to start the oracle ? or Do I

Dequeue using Java for Oracle 11g queue

白昼怎懂夜的黑 提交于 2019-12-11 06:23:48
问题 I'm trying to dequeue using Oracle 11g queue using standlone java. Here is the code: public class testq { public static void main(String[] args) throws Exception { testq q = new testq(); AQSession aq_sess = createSession(); q.runTest(aq_sess); } public static AQSession createSession() { Connection db_conn; AQSession aq_sess = null; try { DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver()); /* Load the Oracle8i AQ driver: */ Class.forName("oracle.AQ.AQOracleDriver"); db_conn =

issue in Number generation in Sequence using Cache

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 06:21:25
问题 I have a sequence created with nocycle , noorder , cache 100 and increment by 1 . I am using the below SQL to generate sequence: select myseq.nextVal from dual; With this sequence I got values between 206764957 and 206765478 on one day. After few days when I used this process again it gave me values between 206765361 and 206793474 . So in my first run the highest number was 206765478 and in my second run the lowest number was 206765361 . I was expecting all of the numbers to in the second run

Xml bulk insert in oracle table

故事扮演 提交于 2019-12-11 06:19:41
问题 Im new to oracle, what im trying is, I have an xml, i try to insert the same in a oracle database table, i have formed a query, when i try to insert it. i get some Error like Error report - ORA-06550: line 35, column 84: PL/SQL: ORA-00933: SQL command not properly ended ORA-06550: line 5, column 2: PL/SQL: SQL Statement ignored 06550. 00000 - "line %s, column %s:\n%s" *Cause: Usually a PL/SQL compilation error. *Action: i couldnt able to figure out what i missed, Suggest me how to change the

Finding non-numeric values in varchar column

走远了吗. 提交于 2019-12-11 06:19:14
问题 Requirement : Generic query/function to check if the value provided in a varchar column in a table is actually a number & the precision does not exceed the allowed precision. Available values: Table_Name, Column_Name, Allowed Precision, Allowed Scale General advise would be to create a function & use to_number() to validate the value however it won't validate the allowed length (precision-scale). My solution: Validate Number using Regexp NOT REGEXP_LIKE(COLUMN_NAME, '^-?[0-9.]+$') Validate

ORA-00900: invalid SQL statement error?What's wrong with my sql?

自闭症网瘾萝莉.ら 提交于 2019-12-11 06:07:23
问题 I try to write a function that split the string,but it shows: ORA-00900: invalid SQL statement error .What's wrong?I think that v_str varchar2(500); or v_strs_last varchar2(4000) := p_value; may be wrong. CREATE OR REPLACE TYPE strsplit_type IS TABLE OF VARCHAR2 (4000); create or replace function strsplit(p_value varchar2, p_split varchar2 := ',') return strsplit_type pipelined is v_idx integer; v_str varchar2(500); v_strs_last varchar2(4000) := p_value; begin loop v_idx := instr(v_strs_last,

Oracle 11g Broken Materialized view: Stop refresh without dropping view or refreshing view?

落花浮王杯 提交于 2019-12-11 05:57:30
问题 So I've got a materalized view (I know...) : CREATE MATERIALIZED VIEW vw_my_view_here REFRESH COMPLETE START WITH SYSDATE NEXT SYSDATE + 1/24 AS /*huge-ass select statement here*/ UNION ALL /*huge-ass select statement here*/ UNION ALL /*huge-ass select statement here*/ UNION ALL /*huge-ass select statement here*/ This has been present in our system for some time without causing issues. One of these select queries is broken (somehow - presumibly schema changes in the underlying tables) and has