Search Results

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

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

  • Table transformation / field parsing in PL/SQL

    - by IMHO
    I have de-normalized table, something like CODES ID | VALUE 10 | A,B,C 11 | A,B 12 | A,B,C,D,E,F 13 | R,T,D,W,W,W,W,W,S,S The job is to convert is where each token from VALUE will generate new record. Example: CODES_TRANS ID | VALUE_TRANS 10 | A 10 | B 10 | C 11 | A 11 | B What is the best way to do it in PL/SQL without usage of custom pl/sql packages, ideally with pure SQL? Obvious solution is to implement it via cursors. Any ideas?

    Read the article

  • Updating a table with the max date of another table

    - by moleboy
    In Oracle 10g, I need to update Table A with data from Table B. Table A has LOCATION, TRANDATE, and STATUS. Table B has LOCATION, STATUSDATE, and STATUS I need to update the STATUS column in Table A with the STATUS column from Table B where the STATUSDATE is the max date upto and including the TRANDATE for that LOCATION (basically, I'm getting the status of the location at the time of a particular transaction). I have a PL/SQL procedure that will do this but I KNOW there must be a way to get it to work using an analytic, and I've been banging my head too long. Thanks!

    Read the article

  • Run Sql*Plus commands on Application Express

    - by pesantos
    Hi, I am new to PL/SQL, I'm trying to execute the commands that I learned at the course. VARIABLE area NUMBER DECLARE radius NUMBER(2) := &s_radius; pi CONSTANT NUMBER := 3.14; BEGIN :area := pi * radius * radius; END; I understand that I can run this using SqlPlus, but I remember my teacher was running this from the web browser using Application Express. I try to run the same commands there, at HOME SQLSQL Commands, but I keep getting the error "ORA-00900: invalid SQL statement" . Can you help me run it in Application Express or point me to a way where I can use an editor to run these course exercises? Thanks!

    Read the article

  • Getting user data from Active Directory using PL/SQL

    - by David Neale
    I had a discussion today regarding an Oracle procedure I wrote some time ago. I wanted to get 7500 user email addresses from Active Directory using PL/SQL. AD will return a maximum of 1000 rows and the LDAP provider used by Oracle will not support paging. Therefore, my solution was to filter on the last two characters of the sAMAccountName (*00,*01,*02...etc.). This results in 126 queries (100 for account names ending in digits, 26 for those ending in a letter...this was sufficient for my AD setup). The person I was speaking to (it was a job interview by the way) said he could have done it a better way, but he would not tell me what that method was. Could anybody hazard a guess at what this method was?

    Read the article

  • Does anyone use the PL/SQL Web Toolkit?

    - by colinjameswebb
    Does anyone use the PL/SQL Web Toolkit at all? We use it for internal reporting where I work. However, does anyone have any experiences of it for producing client-facing websites? General advantages/disadvantages compared to other web languages, such as JSP, PHP etc

    Read the article

  • PL DOC source forge - 2 issues

    - by user1792793
    I'm attempting to use PLDOC source forge (http://pldoc.sourceforge.net/maven-site/) with my code to generate a neat page with comments of my liking. I'm coming across 2 issues, any help would be appreciated. 1 I've been using tags (/**, */) to make comments and this works perfectly for functions, but does not appear in procedures. My Functions and procedures are independent and not in packages, and trying to add comments before the PROCEDURE declaration just gets deleted when saved. 2 if i try to use the recommended method of getting the data directly from teh database (call pldoc.bat -url jdbc:oracle:thin:@localhost:1521:ORCL -user SCOTT -password TIGER -sql SYS_OWNER.DBMS_PIPE,SYS_OWNER.DBMS_OUTPUT), it puts all the available functions and procedures under the user SIS_OWNER (SIS_owner is the only link available on the left hand side). I want to change this so that I can view all the methods in the list instead. Problem with procedures stated in 1 still exists with this method. Please let me know if you have overcome this and any pointers would be great. Thanks

    Read the article

  • Find the highest number of occurences in a column in SQL

    - by Ronnie
    Given this table: Order custName description to_char(price) A desa $14 B desb $14 C desc $21 D desd $65 E dese $21 F desf $78 G desg $14 H desh $21 I am trying to display the whole row where prices have the highest occurances, in this case $14 and $21 I believe there needs to be a subquery. So i started out with this: select max(count(price)) from orders group by price which gives me 3. after some time i didn't think that was helpful. i believe i needed the value 14 and 21 rather the the count so i can put that in the where clause. but I'm stuck how to display that. any help?

    Read the article

  • oracle collection not enough values

    - by john
    I did following: create or replace type my_row as object ( lname varchar2(30), fname varchar2(30), MI char(1), hohSSN char (9), hohname VARCHAR2(63), hohDob char(10), dob DATE ); create or replace type eiv.my_rec as table of eiv.my_row; but then doing query like: my_records my_rec select '', '', '', '', '', '', sysdate bulk collect into my_records from dual; gives error ORA-00947: not enough values what can i be doing wrong here?

    Read the article

  • Strange behavior with large Object Types

    - by Peter Lang
    I recognized that calling a method on an Oracle Object Type takes longer when the instance gets bigger. The code below just adds rows to a collection stored in the Object Type and calls the empty dummy-procedure in the loop. Calls are taking longer when more rows are in the collection. When I just remove the call to dummy, performance is much better (the collection still contains the same number of records): Calling dummy: Not calling dummy: 11 0 81 0 158 0 Code to reproduce: Create Type t_tab Is Table Of VARCHAR2(10000); Create Type test_type As Object( tab t_tab, Member Procedure dummy ); Create Type Body test_type As Member Procedure dummy As Begin Null; --# Do nothing End dummy; End; Declare v_test_type test_type := New test_type( New t_tab() ); Procedure run_test As start_time NUMBER := dbms_utility.get_time; Begin For i In 1 .. 200 Loop v_test_Type.tab.Extend; v_test_Type.tab(v_test_Type.tab.Last) := Lpad(' ', 10000); v_test_Type.dummy(); --# Removed this line in second test End Loop; dbms_output.put_line( dbms_utility.get_time - start_time ); End run_test; Begin run_test; run_test; run_test; End; I tried with both 10g and 11g. Can anyone explain/reproduce this behavior?

    Read the article

  • How to use DML on Oracle temporary table without generating much undo log

    - by Sambath
    Hi, Using an Oracle temporary table does not generate much redo log as a normal table. However, the undo log is still generated. Thus, how can I write insert, update, or delete statement on a temporary table but Oracle will not generate undo log or generate as little as possible? Moreover, using /+append/ in the insert statement will generate little undo log. Am I correct? If not, could anyone explain me about using the hint /+append/? INSERT /*+APPEND*/ INTO table1(...) VALUES(...); Thank you.

    Read the article

  • Oracle Training Providers

    - by RC
    I'm looking to find an Oracle PL/SQL training course for a colleague of mine. I've had first-hand experience with Oracle University and was quite satisfied with my experience, but the courses currently available through Oracle University are limited to options out of our budget when considering travel and 5 days of hotel. I'm wondering what other good providers of Oracle training are out there and what fellow developers are having positive experiences with. Travel is expected, but we are based out of Atlanta, GA so suggestions in the vicinity would be a plus.

    Read the article

  • How can fill a variable of my own created data type within Oracle PL/SQL?

    - by Frankie Simon
    In Oracle I've created a data type: TABLE of VARCHAR2(200) I want to have a variable of this type within a Stored Procedure (defined locally, not as an actual table in the DB) and fill it with data. Some online samples show how I'd use my type if it was filled and passed as a parameter to the stored procedure: SELECT column_value currVal FROM table(pMyPassedParameter) However what I want is to fill it during the PL/SQL code itself, with INSERT statements. Anyone knows the syntax of this?

    Read the article

  • Loop through multiple tables to execute same query

    - by pcvnes
    Hi, I have a database wherein per day a table is created to log process instances. The tables are labeled MESSAGE_LOG_YYYYMMDD Currently i want to sequentially execute the same QUERY against all those tables. I wrote the PL/SQL below, but got stuck at line 10. How can i execute the SQL statement against successfully against all tables here ? DECLARE CURSOR all_tables IS SELECT table_name FROM all_tables WHERE TABLE_NAME like 'MESSAGE_LOG_2%' ORDER BY TABLE_NAME ; BEGIN FOR msglog IN all_tables LOOP SELECT count(*) FROM TABLE msglog.TABLE_NAME ; END LOOP; END; / Cheers, Peter

    Read the article

  • Run Oracle Procedure just to lock row, without returning a resultset

    - by Pascal
    I want to run a procedure to force a row lock on a row, but I don't want to return a result set to the client, nor do I actually want to update anything. Below is the proc: CREATE OR REPLACE PROCEDURE SP_LOCK_Row (IDRow IN INTEGER) IS BEGIN SELECT * FROM TBLTable WHERE IDRow = IDRow FOR UPDATE; END; The problem is that I keep getting the error: PLS-00428: an INTO clause is expected in this SELECT statement. Is there a way for me to lock the row without actually having to return a result set back to the client? The SQL Server equivalent is: CREATE PROCEDURE dbo.SP_LOCK_Row( @IDRow INT) AS SELECT * FROM dbo.TBLTable WITH (UPDLOCK, ROWLOCK) WHERE IDRow = @IDRow Tks

    Read the article

  • Writing a query to find MAX number in PL/SQL

    - by user2461116
    I am suppose to Write a query that will display the largest number of movies rented by one member and that member's name. Give the output column a meaningful name such as MAXIMUM NUMBER. This is what I have. select max(maximum_movies) from (select count(*)maximum_movies from mm_member join mm_rental on mm_rental.member_id = mm_member.member_id group by first, last); I got the maximum number but the output should be like this. First Last Maximum_movies John Doe 4 But the output is Maximum_movies 4 Any suggestions?

    Read the article

  • Insert or Update using Oracle and PL/SQL

    - by Shane
    I have a PL/SQL function that performs an update/insert on an Oracle database that maintains a target total and returns the difference between the existing value and the new value. Here is the code I have so far: FUNCTION calcTargetTotal(accountId varchar2, newTotal numeric ) RETURN number is oldTotal numeric(20,6); difference numeric(20,6); begin difference := 0; begin select value into oldTotal from target_total WHERE account_id = accountId for update of value; if (oldTotal != newTotal) then update target_total set value = newTotal WHERE account_id = accountId difference := newTotal - oldTotal; end if; exception when NO_DATA_FOUND then begin difference := newTotal; insert into target_total ( account_id, value ) values ( accountId, newTotal ); -- sometimes a race condition occurs and this stmt fails -- in those cases try to update again exception when DUP_VAL_ON_INDEX then begin difference := 0; select value into oldTotal from target_total WHERE account_id = accountId for update of value; if (oldTotal != newTotal) then update target_total set value = newTotal WHERE account_id = accountId difference := newTotal - oldTotal; end if; end; end; end; return difference end calcTargetTotal; This works as expected in unit tests with multiple threads never failing. However when loaded on a live system we have seen this fail with a stack trace looking like this: ORA-01403: no data found ORA-00001: unique constraint () violated ORA-01403: no data found The line numbers (which I have removed since they are meaningless out of context) verify that the first update fails due to no data, the insert fail due to uniqueness, and the 2nd update is failing with no data, which should be impossible. From what I have read on other thread a MERGE statement is also not atomic and could suffer similar problems. Does anyone have any ideas how to prevent this from occurring?

    Read the article

  • Oracle PL/SQL: Dump query result into file

    - by CC
    Hi. I'm working on a pl sql stored procedure. What I need is to do a select, use a cursor and for every record build a string using values. At the end I need to write this into a file. I try to use dbms_output.put_line("toto") but the buffer size is to small because I have about 14 millions lines. I call my procedure from a unix ksh. I'm thinking at something like using "spool on" (on the ksh side) to dump the result of my procedure, but I don' know how to do it (if this is possible) Anyone has any idea? Thank alot. C.C.

    Read the article

  • Custom order in Oracle PL/SQL

    - by Jasim
    I have an oracle query in which and i want the result to be in custom order 'SENIOR DIRECTOR', 'DIRECTOR', 'MANAGER', 'EMPLOYEE' which is from the field GRADE_DESCRIPTON. I am using the below query. However I am not getting the desired result The order of the result im getting is 'SENIOR DIRECTOR','MANAGER', DIRECTOR,'EMPLOYEE' SELECT DISTINCT GRADE_DESCRIPTION, HIRING_FORECATS.* FROM GRADE_MASTER left join IRING_FORECATS ON (HIRING_FORECATS.GRADE = GRADE_MASTER.GRADE_DESCRIPTION and HIRING_FORECATS.LOCATION = 'HO' ) order by decode(GRADE_MASTER.GRADE_DESCRIPTION, 'SENIOR DIRECTOR', 'DIRECTOR', 'MANAGER', 'EMPLOYEE') Any Suggestions??

    Read the article

  • Exporting collections

    - by Ruslan
    Hi, have select like select trn_dt,collect(ac_no) from transactions where rownum < 1000 group by trn_dt i'm doing it in SQL Navigator. But i can't export results! Table collect(ac_no) is not exported. Is there any way out?

    Read the article

  • Run time insert using bulk update ,giving an internal error?

    - by Vineet
    Hi , I am trying to make a run time table named dynamic and inserting data into it from index by table using bulk update,but when i am trying to execute it this error is coming: ERROR at line 1: ORA-06550: line 0, column 0: PLS-00801: internal error [74301 ] declare type index_tbl_type IS table of number index by binary_integer; num_tbl index_tbl_type; TYPE ref_cur IS REF CURSOR; cur_emp ref_cur; begin execute immediate 'create table dynamic (v_num number)';--Creating a run time tabl FOR i in 1..10000 LOOP execute immediate 'insert into dynamic values('||i||')';--run time insert END LOOP; OPEN cur_emp FOR 'select * from dynamic';--opening ref cursor FETCH cur_emp bulk collect into num_tbl;--bulk inserting in index by table close cur_emp; FORALL i in num_tbl.FIRST..num_tbl.LAST --Bulk update execute immediate 'insert into dynamic values('||num_tbl(i)||')'; end;

    Read the article

  • Oracle (Old?) Joins - A tool for conversion?

    - by Grasper
    I have been porting oracle selects, and I have been running across a lot of queries like so: SELECT e.last_name, d.department_name FROM employees e, departments d WHERE e.department_id(+) = d.department_id; ...and: SELECT last_name, d.department_id FROM employees e, departments d WHERE e.department_id = d.department_id(+); Are there any guides/tutorials for converting all of the variants of the (+) syntax? What is that syntax even called (so I can scour google)? Even better.. Is there a tool that will do this conversion for me? When was this standard phased out? Any info is appreciated.

    Read the article

  • How do I write an Oracle SQL query for this tricky question?

    - by atrueguy
    Here is the table data with the column name as Ships. +--------------+ Ships | +--------------+ Duke of north | ---------------+ Prince of Wales| ---------------+ Baltic | ---------------+ Replace all characters between the first and the last spaces (excluding these spaces) by symbols of an asterisk (*). The number of asterisks must be equal to number of replaced characters.

    Read the article

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