Search Results

Search found 304 results on 13 pages for 'plsql'.

Page 5/13 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Query performance difference pl/sql forall insert and plain SQL insert

    - by user289429
    We have been using temporary table to store intermediate results in pl/sql Stored procedure. Could anyone tell if there is a performance difference between doing bulk collect insert through pl/sql and a plain SQL insert. Insert into or Cursor for open cursor fetch cursor bulk collect into collection Use FORALL to perform insert Which of the above 2 options is better to insert huge amount of temporary data?

    Read the article

  • Invoking a PL/SQL function from EclipseLink

    - by Mark Robinson
    I'm trying to execute a PL/SQL function in EclipseLink which uses Oracle Specific types(eg. Boolean). I've tried using PLSQLStoredProcedureCall which complains that I'm not executing a procedure and I have tried using StoredFunctionCall but that returns PLS-00382: expression is of wrong type Has anyone developed a solution to invoke functions in EclipseLink with Oracle Types? I have heard that it would be possible to extend StoredFunctionCall but I'd rather leverage existing functionality as much as possible.

    Read the article

  • PL/SQL - How to pull data from 3 tables based on latest created date

    - by Nancy
    Hello, I'm hoping someone can help me as I've been stuck on this problem for a few days now. Basically I'm trying to pull data from 3 tables in Oracle: 1) Orders Table 2) Vendor Table and 3) Master Data Table. Here's what the 3 tables look like: Table 1: BIZ_DOC2 (Orders table) OBJECTID (Unique key) UNIQUE_DOC_NAME (Document Name i.e. ORD-005) CREATED_AT (Date the order was created) Table 2: UDEF_VENDOR (Vendors Table): PARENT_OBJECT_ID (This matches up to the ObjectId in the Orders table) VENDOR_OBJECT_NAME (This is the name of the vendor i.e. Acme) Table 3: BIZ_UNIT (Master Data table) PARENT_OBJECT_ID (This matches up to the ObjectID in the Orders table) BIZ_UNIT_OBJECT_NAME (This is the name of the business unit i.e. widget A, widget B) Note: The Vendors Table and Master Data do not have a link between them except through the Orders table. I can join all of the data from the tables and it looks something like this: Before selecting latest order date: ORD-005 | Widget A | Acme | 3/14/10 ORD-005 | Widget B | Acme | 3/14/10 ORD-004 | Widget C | Acme | 3/10/10 Ideally I'd like to return the latest order for each vendor. However, each order may contain multiple business units (e.g. types of widgets) so if a Vendor's latest record is ORD-005 and the order contains 2 business units, here's what the result set should look like by the following columns: UNIQUE_DOC_NAME, BIZ_UNIT_OBJECT_NAME, VENDOR_OBJECT_NAME, CREATED_AT After selecting by latest order date: ORD-005 | Widget A | Acme | 3/14/10 ORD-005 | Widget B | Acme | 3/14/10 I tried using Select Max and several variations of sub-queries but I just can't seem to get it working. Any help would be hugely appreciated!

    Read the article

  • Iterating Oracle collections of objects with out exploding them

    - by Scott Bailey
    I'm using Oracle object data types to represent a timespan or period. And I've got to do a bunch of operations that involve working with collections of periods. Iterating over collections in SQL is significantly faster than in PL/SQL. CREATE TYPE PERIOD AS OBJECT ( beginning DATE, ending DATE, ... some member functions...); CREATE TYPE PERIOD_TABLE AS TABLE OF PERIOD; -- sample usage SELECT <<period object>>.contains(period2) FROM TABLE(period_table1) t The problem is that the TABLE() function explodes the objects into scalar values, and I really need the objects instead. I could use the scalar values to recreate the objects but this would incur the overhead of re-instantiating the objects. And the period is designed to be subclassed so there would be additional difficulty trying to figure out what to initialize it as. Is there another way to do this that doesn't destroy my objects?

    Read the article

  • PL/SQL profiler missing data

    - by user289429
    We are using pl/sql profiler to collect metrics. We noticed that on one of the environment the plsql_profiler_runs table is populated with the total execution time but the finer details that gets collected in the table plsql_profiler_data is missing. Any idea why this would be happening? We do use dbms_profiler.flush_data() before stopping the profiler and have seen this work fine in another environment.

    Read the article

  • Return an Oracle Associative Array from a function

    - by Paul Johnson
    Does anybody know if it is possible to return an associative array as the result of an Oracle function, if so do you have any examples? I have an Oracle package which contains an associative array declaration as defined below: TYPE EVENTPARAM IS TABLE OF NUMBER INDEX BY BINARY_INTEGER; This is then used in a stored procedure outside the package as follows: v_CompParams areva_interface.eventparam; The intention is to store an associative array of strings in the variable v_CompParams, returned from a Parse function in another package. The definition for which is as follows: PACKAGE STRING_MANIP IS TYPE a_array IS TABLE OF NUMBER INDEX BY BINARY_INTEGER; FUNCTION Parse (v_string VARCHAR2, v_delim VARCHAR2) RETURN a_array; FUNCTION RowCount(colln IN a_array) RETURN NUMBER; END; The code which implements this is: v_CompParams := STRING_MANIP.PARSE(v_CompID,v_Delim); Unfortunately it doesn't work, I get the error 'PLS-00382: expression is of wrong type'. I foolishly assumed, that since a_array derives from the same source Oracle type as the variable v_CompParams, that there would be no problem casting between them. Any help much appreciated. Kind Regards Paul J.

    Read the article

  • ways to avoid global temp tables in oracle

    - by Omnipresent
    We just converted our sql server stored procedures to oracle procedures. Sql Server SP's were highly dependent on session tables (INSERT INTO #table1...) these tables got converted as global temporary tables in oracle. We ended up with aroun 500 GTT's for our 400 SP's Now we are finding out that working with GTT's in oracle is considered a last option because of performance and other issues. what other alternatives are there? Collections? Cursors? Our typical use of GTT's is like so: Insert into GTT INSERT INTO some_gtt_1 (column_a, column_b, column_c) (SELECT someA, someB, someC FROM TABLE_A WHERE condition_1 = 'YN756' AND type_cd = 'P' AND TO_NUMBER(TO_CHAR(m_date, 'MM')) = '12' AND (lname LIKE (v_LnameUpper || '%') OR lname LIKE (v_searchLnameLower || '%')) AND (e_flag = 'Y' OR it_flag = 'Y' OR fit_flag = 'Y')); Update the GTT UPDATE some_gtt_1 a SET column_a = (SELECT b.data_a FROM some_table_b b WHERE a.column_b = b.data_b AND a.column_c = 'C') WHERE column_a IS NULL OR column_a = ' '; and later on get the data out of the GTT. These are just sample queries, in actuality the queries are really complext with lot of joins and subqueries. I have a three part question: Can someone show how to transform the above sample queries to collections and/or cursors? Since with GTT's you can work natively with SQL...why go away from the GTTs? are they really that bad. What should be the guidelines on When to use and When to avoid GTT's

    Read the article

  • Running pl/sql in Korn Shell(AIX)

    - by learner135
    I have a file to execute in Ksh written by someone. It has a set of commands to execute in sqlplus. It starts with, sqlplus -s $UP <<- END followed by a set of ddl commands such as create,drop,etc., When I execute the file in the shell, I get the error in the starting line quoted above. I understand "-s" starts the sqlplus in silent mode and $UP is the connection string with username/password. But I couldn't make heads or tails of "<<- END" part(Many sites from google says input redirection is "<<" not "<<-"). So I presumed the error must be in that part and removed it from the file. Now it reads, sqlplus -s $UP But once I execute the file, It waits for input from the shell, instead of reading the rest of the lines from the file. How would I make sqlplus to execute the ddl commands in the rest of the file?. Thanks in advance.

    Read the article

  • PL/SQL Package invalidated

    - by FrustratedWithFormsDesigner
    I have a script that makes use of a package (PKG_MY_PACKAGE). I will change some of the fields in a query in that package and then recompile it (I don't change or compile any other packages). I run the script and I get an error that looks like ORA-04068: existing state of packages has been discarded ORA-04061: existing state of package body "USER3.PKG_MY_PACKAGE" has been invalidated ORA-04065: not executed, altered or dropped package body "USER3.PKG_MY_PACKAGE" ORA-06508: PL/SQL: could not find program unit being called: "USER3.PKG_MY_PACKAGE" ORA-06512: at line 34 I run the script again (without changing anything else in the system) and the script executes successfully. I thought that when I compiled before I executed the script that would fix any invalid references. This is 100% reproducible, and the more I test this script the more annoying it gets. What could cause this, and what would fix it? (oracle 10g, using PL/SQL Developer 7)

    Read the article

  • SYSDATE - 1 error on pl/sql function

    - by ayo
    Hi curtisk/all, I have an issue: when i issue this function below ti gives me the following error: select 'EXECUTE DBMS_LOGMNR.ADD_LOGFILE(LOGFILENAME =>'''||name||'''||,OPTIONS=>DBMS_LOGMNR.NEW);' from v\$archived_log where name is not null; select 'EXECUTE DBMS_LOGMNR.ADD_LOGFILE(LOGFILENAME =>'''||name||'''||,OPTIONS=>DBMS_LOGMNR.ADDFILE);' from v\$archived_log where name is not null; EXECUTE DBMS_LOGMNR.START_LOGMNR( STARTTIME => SYSDATE - 1, ENDTIME => SYSDATE, OPTIONS => DBMS_LOGMNR.DICT_FROM_ONLINE_CATALOG + DBMS_LOGMNR.CONTINUOUS_MINE + DBMS_LOGMNR.COMMITTED_DATA_ONLY + DBMS_LOGMNR.PRINT_PRETTY_SQL); Error: * ERROR at line 1: ORA-01291: missing logfile ORA-06512: at "SYS.DBMS_LOGMNR", line 58 ORA-06512: at line 1 But i have added all the archived logs for several days before and my sysdate is at today. Kindly help out on this issue. thanks. Reagrds Ayo

    Read the article

  • Merging exists and not exists into one query - oracle magic

    - by stic
    Hi, In a WHERE part of query we have SELECT * FROM SomeTable st WHERE NOT EXISTS (SELECT 1 FROM Tab t1 WHERE t1.A = st.A OR t1.B = st.A) OR EXISTS (SELECT 1 FROM Tab t2 WHERE (t2.A = st.A OR t2.B = st.A) AND t2.C IS NULL) Seems like a good candidate for merging... But I'm staring on that for an hour without any idea. Would you have some thoughts? Thanks,

    Read the article

  • How to identify what locked PL/SQL package (Oracle 10.0.4.2)?

    - by Roman Kagan
    I was trying to recompile PL/SQL package and no avail. because something obtained the lock and that wasn't released for long time. As soon as I kill all sessions I was able to recompile but encounter the same behavior (i.e. locked package) and I wonder what tools are avail to identify what could of obtain it and never release it? This happen on (Oracle 10.0.4.2). Greatly appreciate for your help.

    Read the article

  • help translate this week query from Oracle PL/SQL to SQL Server 2008

    - by Sarah Vessels
    I have the following query that runs in my Oracle database and I want to have the equivalent for a SQL Server 2008 database: SELECT TRUNC( /* Midnight Sunday */ NEXT_DAY(SYSDATE, 'SUN') - (7*LEVEL) ) AS week_start, TRUNC( /* 23:59:59 Saturday */ NEXT_DAY(NEXT_DAY(SYSDATE, 'SUN') - (7*LEVEL), 'SAT') + 1 ) - (1/(60*24)) + (59/(60*60*24)) AS week_end FROM DUAL CONNECT BY LEVEL <= 4 /* Get the past 4 weeks */ What the query does is get the start of the week and the end of the week for the last 4 weeks. It generates data like the following: WEEK_START WEEK_END 2010-03-07 00:00:00 2010-03-13 23:59:59 2010-02-28 00:00:00 2010-03-06 23:59:59 ...

    Read the article

  • Concatenate CLOB-rows with PL/SQL

    - by david K
    Hi, I've got a table which has an id and a clob content like: Create Table v_example_l ( nip number, xmlcontent clob ); We insert our data: Insert into V_EXAMPLE_L (NIP,XMLCONTENT) Values (17852,'<section><block><name>delta</name><content>548484646846484</content></block></section>'); Insert into V_EXAMPLE_L (NIP,XMLCONTENT) Values (17852,'<section><block><name>omega</name><content>545648468484</content></block></section>'); Insert into V_EXAMPLE_L (NIP,XMLCONTENT) Values (17852,'<section><block><name>gamma</name><content>54564846qsdqsdqsdqsd8484</content></block></section>'); I'm trying to do a function that concatenates the rows of the clob that gone be the result of a select, i mean without having to give multiple parameter about the name of table or such, i should only give here the column that contain the clobs, and it should handle the rest. CREATE OR REPLACE function assemble_clob(q varchar2) return clob is v_clob clob; tmp_lob clob; hold VARCHAR2(4000); --cursor c2 is select xmlcontent from V_EXAMPLE_L where id=17852 cur sys_refcursor; begin OPEN cur FOR q; LOOP FETCH cur INTO tmp_lob; EXIT WHEN cur%NOTFOUND; --v_clob := v_clob || XMLTYPE.getClobVal(tmp_lob.xmlcontent); v_clob := v_clob || tmp_lob; END LOOP; return (v_clob); --return (dbms_xmlquery.getXml( dbms_xmlquery.set_context("Select 1 from dual")) ) end assemble_clob; The function is broken... (if anybody could give me a help, thanks a lot, and i'm noob in sql so ....). Thanks!

    Read the article

  • Parsing pipe delimited string into columns?

    - by DMS
    Hello, I have a column with pipe separated values such as: '23|12.1| 450|30|9|78|82.5|92.1|120|185|52|11' I want to parse this column to fill a table with 12 corresponding columns: month1, month2, month3...month12. So month1 will have the value 23, month2 the value 12.1 etc... Is there a way to parse it by a loop or delimeter instead of having to separate one value at a time using substr? Thanks.

    Read the article

  • PL/SQL Logical Operators evaluate whole function

    - by Chris
    I know in C like languages logical operators are evaluated one at a time so: false && really_expensive_function() is doesn't result in the function being called (I can't remember the CS name for this). Does the same happen in PL/SQL or do I need to break the IF parts out to separate blocks?

    Read the article

  • Best Way to Generate Unique and consecutives numbers in Oracle

    - by RRUZ
    I need to generate unique and consecutive numbers (for use on an invoice), in a fast and reliable way. currently use a Oracle sequence, but in some cases generated numbers are not consecutive because of exceptions that may occur. I thought a couple of solutions to manage this problem, but neither of they convincing me. What solution do you recommend? Use a select max () SELECT MAX (NVL (doc_num, 0)) +1 FROM invoices Use a table to store the last number generated for the invoice. UPDATE docs_numbers SET last_invoice = last_invoice + 1 Another Solution?

    Read the article

  • Upper Bound in FOR loop does not get altered in loop,Why?

    - by Vineet
    Hi ALL, I am trying to change the value of upper bound in For loop ,but the Loop is running till the upper bound which was defined in the starting. According to logic loop should go infinite, since value of v_num is always one ahead of i,But loop is executing three time.Please explain This is the code DECLARE v_num number:=3; BEGIN FOR i IN 1..v_num LOOP v_num:=v_num+1; DBMS_OUTPUT.PUT_LINE(i ||' '||v_num); END LOOP; END; Ouput Coming 1 4 2 5 3 6

    Read the article

  • PL/SQL time segment calculation

    - by Steve
    Hi, I need to figure how much time passed between 2 times. For example: (14:00:00 - 13:15:00) * 24 = .75 I need this to later on convert KW to KWh, but that's not the point. I can not find out how to do this in PL/SQL. My date/time fields look like this in the DB: 1/23/2010 21:00:00 I would appreciate any suggestions. Steve

    Read the article

  • Oracle: Use of notational parameters which calling functions in insert statements not allowed ?

    - by Sathya
    Why does Oracle 10 R2 not allow use of notational parameters while calling functions in insert statements ? In my app, I'm calling a function in an insert statement. If use notational method of parameter passing, I get an ORA-00907: Missing right parenthesis error message INSERT INTO foo (a, b, c) VALUES (c, F1(P1=>'1', P2=>'2', P3 => '3'), e) Changing the same to position based parameter passing, and the same code gets compiled with no errors. INSERT INTO foo (a, b, c) VALUES (c, F1('1','2','3'), e) Why is this so ?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >