oracle11g

Trying to figure out max length of Rowid in Oracle

孤者浪人 提交于 2019-12-13 02:19:20
问题 As per my design I want to fetch rowid as in select rowid r from table_name; into a C variable. I was wondering what is the max size / length in characters of the rowid. Currently in one of the biggest tables in my DB we have the max length as 18 and its 18 throughout the table for rowid. Thanks in advance. Edit: Currently the below block of code is iterated and used for multiple tables hence in-order to make the code flexible without introducing the need of defining every table's PK in the

How to audit deletes in a certain table with Oracle?

你说的曾经没有我的故事 提交于 2019-12-13 01:24:51
问题 I'm trying to record DELETE statements in a certain table using Oracle's auditing features. I ran: SQL> AUDIT DELETE TABLE BY TPMDBO BY ACCESS; Audit succeeded. I'm unclear if this audits the deletion of a table schema itself (ie, dropping the table), or if it audits the deletion of one or more rows within any table (ie, the delete command). If the latter, how do I limit this auditing to only a table called Foo ? Thanks! UPDATE: SQL> show parameter audit NAME TYPE VALUE ----------------------

Identifier 'APEX_JSON.PARSE' must be declared in oracle 11.2.0

北城以北 提交于 2019-12-13 01:17:48
问题 I want to parse JSON in Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production . But below error reported: ORA-06550: line 4, column 5: PLS-00201: identifier 'APEX_JSON.PARSE' must be declared Here is my sample code: DECLARE s varchar2(32767) := '{ "a": 1, "b": ["hello", "world"]}'; BEGIN apex_json.parse(s); sys.dbms_output.put_line('a is '||apex_json.get_varchar2(p_path => 'a')); END; Does this version support this feature? 回答1: This depends on the APEX version within

Oracle dbms_job.submit: Mixing Synchronous and Asynchronous

对着背影说爱祢 提交于 2019-12-13 01:06:48
问题 I have 7 Materialized Views that need to be refreshed on a schedule. Five of them are data source independent and could be rebuilt asynchronously. I'd like do use something like Tom described here PROCEDURE refresh_Independent_MViews AS l_job BINARY_INTEGER; BEGIN dbms_job.submit (l_job, 'DBMS_MVIEW.REFRESH(list => ''IndependentMView1'', method => ''C'') ;') ; dbms_job.submit (l_job, 'DBMS_MVIEW.REFRESH(list => ''IndependentMView2'', method => ''C'') ;') ; dbms_job.submit (l_job, 'DBMS_MVIEW

How to get maximum for a field based on a date and get other fields also?

家住魔仙堡 提交于 2019-12-13 01:03:00
问题 I know my question is bit confusing but if I show you data it will make more sense what I am trying to achieve. I am reading everything from one table T only. I am reading 6 fields from that table T. StartKey Name Min LName MName ID Top Table is data, and bottom table is what I am trying to achieve. I need to get for each startkey get max(minutes) FORGOT TO INCLUDE 20130221 in output. Here is what I tried so far select startkey, name, min, lname, mname, id from T where startkey >= '20130118'

Revoke option used on first user after using with grant option

元气小坏坏 提交于 2019-12-13 00:38:50
问题 Im working on Oracle Database 11g: If user A gives the following privileges to user B on a table 'emp' using: Grant select on emp to userB WITH GRANT OPTION; User B gives the same to user C using: Grant select on emp to userC WITH GRANT OPTION; Once this happens, user A uses this: Revoke select on emp from userB; What is the outcome of the following? Im a bit confused on this. 回答1: As long as user B has been granted to "select on emp ... WITH GRANT OPTION" he may forward this privilege to

SQL switch from decode to case

柔情痞子 提交于 2019-12-13 00:35:43
问题 I have a query that does something like this... SELECT * FROM ... ... ORDER BY DECODE(APR(ACC.RATE,'X'), 'FIRST RATE', 1, 'SECOND RATE', 2, 3); Because I am dealing with h2 database and h2 doesnt have decode and decode alias is very difficult to implement so I was wondering if I could convert this DECODE into CASE statement. How do I convert it? 回答1: Decode means: CASE FirstParam WHEN SecondParam THEN ThirdParam WHEN FourthParam THEN FifthParam WHEN SixthParam THEN Seventh... etcetera ELSE

How can I wait until all my scheduler jobs have finished?

蓝咒 提交于 2019-12-13 00:28:41
问题 I'm my package, I'm enqueueing multiple jobs like this: dbms_scheduler.create_job ( job_name => p_job_name , job_type => 'PLSQL_BLOCK' , job_action => p_sql_code , start_date => SYSDATE , enabled => TRUE , comments => 'Running batch jobs in parallel'); Once I've done this for as many parallel jobs that I wish to start, I need to block until all the jobs have completed. Currently I've had to sleeping and polling the the tables ALL_SCHEDULER_JOB_RUN_DETAILS and ALL_SCHEDULER_JOBS and check the

Created Temporary Tables Dynamically

最后都变了- 提交于 2019-12-13 00:23:38
问题 I have scenario like, I need to create a stored procedure in which the columns will come dynamically. Based upon this columns temporary tables should be created. Actually, this scenario I did in SQL Server and I have migrated the SQL Server database to Oracle. Thanks 回答1: If you want to create a table dynamically, you'd need to use dynamic SQL BEGIN EXECUTE IMMEDIATE 'CREATE GLOBAL TEMPORARY TABLE table_name( col1 number, col2 number )'; END; That being said, it is almost certainly a mistake

how to pin a table to oracle dbms_shared_pool in 11G

Deadly 提交于 2019-12-13 00:15:32
问题 Can I pin a table to oracle dbms_shared_pool in 11G? I see I cannot do it in 10g. the table has 4 number columns and around 100K rows, it is extremely high used and read-only(which means we will not insert or update once data is prepared). I didn't find a way so come to here ask. also another question is can I pin a highly used stored procedure to dbms_shared_pool? what's their advantage and disadvantage? is it necessary? 回答1: Pinning tables is a bit pointless. Oracle will keep data which is