Search Results

Search found 244 results on 10 pages for 'oracle10g'.

Page 9/10 | < Previous Page | 5 6 7 8 9 10  | Next Page >

  • Query scope within a table trigger in an Oracle database

    - by sisslack
    I'm been trying to write a table trigger the queries another table that is outside the schema where the trigger will reside. Is this possible? It seems like I have no problem querying tables in my schema but I get: Error: ORA-00942: table or view does not exist when trying trying to query tables outside my schema. The documentation seems to elude to this notion, but it's not 100% clear to me.

    Read the article

  • oracle index for string column - does format of data affects quality of index?

    - by Jayan
    We have following type of "Unique ID" column for many tables in the database (Oracle). It is a string with following format <randomnumber>-<ascendingnumber>-<machinename> So we have some thing like this U1234-12345-NBBJD U1234-12346-NBBJD U1234-12347-NBBJD U1234-12348-NBBJD U1234-12349-NBBJD The UID value is unique, we have unique index on them. Does the following format is more efficient than above for index scans? NBBJD-U1234-12345 NBBJD-U1234-12346 NBBJD-U1234-12347 NBBJD-U1234-12348 NBBJD-U1234-12349

    Read the article

  • Create an Oracle function that returns a table

    - by Craig
    I'm trying to create a function in package that returns a table. I hope to call the function once in the package, but be able to re-use its data mulitple times. While I know I create temp tables in Oracle, I was hoping to keep things DRY. So far, this is what I have: Header: CREATE OR REPLACE PACKAGE TEST AS TYPE MEASURE_RECORD IS RECORD ( L4_ID VARCHAR2(50), L6_ID VARCHAR2(50), L8_ID VARCHAR2(50), YEAR NUMBER, PERIOD NUMBER, VALUE NUMBER ); TYPE MEASURE_TABLE IS TABLE OF MEASURE_RECORD; FUNCTION GET_UPS( TIMESPAN_IN IN VARCHAR2 DEFAULT 'MONTLHY', STARTING_DATE_IN DATE, ENDING_DATE_IN DATE ) RETURN MEASURE_TABLE; END TEST; Body: CREATE OR REPLACE PACKAGE BODY TEST AS FUNCTION GET_UPS ( TIMESPAN_IN IN VARCHAR2 DEFAULT 'MONTLHY', STARTING_DATE_IN DATE, ENDING_DATE_IN DATE ) RETURN MEASURE_TABLE IS T MEASURE_TABLE; BEGIN SELECT ... INTO T FROM ... ; RETURN T; END GET_UPS; END TEST; The header compiles, the body does not. One error message is 'not enough values', which probably means that I should be selecting into the MEASURE_RECORD, rather than the MEASURE_TABLE. What am I missing?

    Read the article

  • How to check data in a column separated by a colon (:)

    - by tonsils
    Hi, I have an Oracle database column, say col1, that has the following values: Col1 (A:B:C) I now need to come along and add to this Col1, only if it doesn’t exist, additional values but unsure how to go about checking to see if Col1 already contains these values. Scenario might be as follows: 1) Need to add B => Outcome=> check Col1 – B exists, do not add. 2) Need to add A:C => Outcome=> check Col1 – A and C exists, do not add. 3) Need to add C:D => Outcome=> check Col1 – C exists but D doesn’t, do not add C but need to add D 4) Need to add G => Outcome=> check Col1 – G doesn’t, need to add G Using Oracle sql or pl/sql I am unsure how to go about processing the above to ensure whether items exist or don’t exist and whether to add or not to add to Col1 Hoping someone can assist with a means of checking the data based on the above. Thanks

    Read the article

  • ORACLE:- 'SELECT ORDER BY ASC' but 'USA' always first.

    - by Robert
    I have to write a drop down query for countries. But USA should always be first. The rest of the countries are in alphabetical order I tried the following query SELECT countries_id ,countries_name FROM get_countries WHERE countries_id = 138 UNION SELECT countries_id ,countries_name FROM get_countries WHERE countries_id != 138 ORDER BY 2 ASC

    Read the article

  • SQL query for the latest record for each day

    - by Mac
    I've got an Oracle 10g database with a table with a structure and content very similar to the following: CREATE TABLE MyTable ( id INTEGER PRIMARY KEY, otherData VARCHAR2(100), submitted DATE ); INSERT INTO MyTable VALUES (1, 'a', TO_DATE('28/04/2010 05:13', ''DD/MM/YYYY HH24:MI)); INSERT INTO MyTable VALUES (2, 'b', TO_DATE('28/04/2010 03:48', ''DD/MM/YYYY HH24:MI)); INSERT INTO MyTable VALUES (3, 'c', TO_DATE('29/04/2010 05:13', ''DD/MM/YYYY HH24:MI)); INSERT INTO MyTable VALUES (4, 'd', TO_DATE('29/04/2010 17:16', ''DD/MM/YYYY HH24:MI)); INSERT INTO MyTable VALUES (5, 'e', TO_DATE('29/04/2010 08:49', ''DD/MM/YYYY HH24:MI)); What I need to do is query the database for the latest record submitted on each given day. For example, with the above data I would expect the records with ID numbers 1 and 4 to be returned, as these are the latest each for 28 April and 29 April respectively. Unfortunately, I have little expertise as far as SQL is concerned. Could anybody possibly provide some insight as to how to achieve this? Thanks in advance!

    Read the article

  • 2 DataBase Schema's syncronization in Oracle 10G

    - by gnash-85
    Hi Masters, Good Day, I am new very naive to oracle DB. I am using Oracle 10G. Let me explain to you. I have one source database named ( DB1) and Target Database named (DB2). I have 2 schema's named dbs1 and dbs2 in the source database (DB1). I have exported both the database schema in Source Database (DB1) and imported it successfully into the Target Database (DB2). Now I face a challenge in synchronizing these database schema's every time from Source DB (DB1) to Target DB (DB2). Can anyone please help in letting me know how can achieve this synchronization. It would a great help. Thanks Nash

    Read the article

  • Cursor loops; How to perform something at start/end of loop 1 time only?

    - by James.Elsey
    I've got the following in one of my Oracle procedures, I'm using it to generate XML -- v_client_addons is set to '' to avoid null error OPEN C_CLIENT_ADDONS; LOOP FETCH C_CLIENT_ADDONS INTO CLIENT_ADDONS; EXIT WHEN C_CLIENT_ADDONS%NOTFOUND; BEGIN v_client_addons := v_client_addons || CLIENT_ADDONS.XML_DATA; END; END LOOP; CLOSE C_CLIENT_ADDONS; -- Do something later with v_client_addons The loop should go through my cursor and pick out all of the XML values to display, such as : <add-on name="some addon"/> <add-on name="another addon"/> What I would like to achieve is to have an XML start/end tag inside this loop, so I would have the following output <addons> <add-on name="some addon"/> <add-on name="another addon"/> </addons> How can I do this without having the <addons> tag after every line? If there are no addons in the cursor (cursor is empty), then I would like to skip this part enitrely

    Read the article

  • Oracle 10g multiple DELETE statements

    - by bmw0128
    I'm building a dml file that first deletes records that may be in the table, then inserts records. Example: DELETE from foo where field1='bar'; DELETE from foo where fields1='bazz'; INSERT ALL INTO foo(field1, field2) values ('bar', 'x') INTO foo(field1, field2) values ('bazz', 'y') SELECT * from DUAL; When I run the insert statement by itself, it runs fine. When I run the deletes, only the last delete runs. Also, it seems to be necessary to end the multiple insert with the select, is that so? If so, why is that necessary? In the past, when using MySQL, I could just list multiple delete and insert statements, all individually ending with a semicolon, and it would run fine.

    Read the article

  • Redundancy in doing sum()

    - by Abhi
    table1 - id, time_stamp, value This table consists of 10 id's. Each id would be having a value for each hour in a day. So for 1 day, there would be 240 records in this table. table2 - id Table2 consists of a dynamically changing subset of id's present in table1. At a particular instance, the intention is to get sum(value) from table1, considering id's only in table2, grouping by each hour in that day, giving the summarized values a rank and repeating this each day. the query is at this stage: select time_stamp, sum(value), rank() over (partition by trunc(time_stamp) order by sum(value) desc) rn from table1 where exists (select t2.id from table2 t2 where id=t2.id) and time_stamp >= to_date('05/04/2010 00','dd/mm/yyyy hh24') and time_stamp <= to_date('25/04/2010 23','dd/mm/yyyy hh24') group by time_stamp order by time_stamp asc If the query is correct, can this be made more efficient, considering that, table1 will actually consist of thousand's of id's instead of 10 ? EDIT: I am using sum(value) 2 times in the query, which I am not able to get a workaround such that the sum() is done only once. Pls help on this

    Read the article

  • Function to extract data in insert into satement for a table.

    - by user269484
    Hi...I m using this Function to extract the data but unable to extract LONG datatype. Can anyone help me? create or replace Function ExtractData(v_table_name varchar2) return varchar2 As b_found boolean:=false; v_tempa varchar2(8000); v_tempb varchar2(8000); v_tempc varchar2(255); begin for tab_rec in (select table_name from user_tables where table_name=upper(v_table_name)) loop b_found:=true; v_tempa:='select ''insert into '||tab_rec.table_name||' ('; for col_rec in (select * from user_tab_columns where table_name=tab_rec.table_name order by column_id) loop if col_rec.column_id=1 then v_tempa:=v_tempa||'''||chr(10)||'''; else v_tempa:=v_tempa||',''||chr(10)||'''; v_tempb:=v_tempb||',''||chr(10)||'''; end if; v_tempa:=v_tempa||col_rec.column_name; if instr(col_rec.data_type,'CHAR') 0 then v_tempc:='''''''''||'||col_rec.column_name||'||'''''''''; elsif instr(col_rec.data_type,'DATE') 0 then v_tempc:='''to_date(''''''||to_char('||col_rec.column_name||',''mm/dd/yyyy hh24:mi'')||'''''',''''mm/dd/yyyy hh24:mi'''')'''; else v_tempc:=col_rec.column_name; end if; v_tempb:=v_tempb||'''||decode('||col_rec.column_name||',Null,''Null'','||v_tempc||')||'''; end loop; v_tempa:=v_tempa||') values ('||v_tempb||');'' from '||tab_rec.table_name||';'; end loop; if Not b_found then v_tempa:='-- Table '||v_table_name||' not found'; else v_tempa:=v_tempa||chr(10)||'select ''-- commit;'' from dual;'; end if; return v_tempa; end; /

    Read the article

  • Does Oracle 10g automatically escape double quotes in recordsets?

    - by bitstream
    I am encountering an interesting issue with an application that was migrated from Oracle 9i to 10g. Previously, we had a problem when a field contained double quotes since Oracle recordsets encapsulated fields in double quotes. Example: "field1"||"field2"||"field "Y" 3"||"field4" Since the move to 10g, I believe that the Oracle client-side driver is parsing the double quotes and replacing them with &quot; Unfortunately I don't have an old 9i environment to test my theory. Have you seen similar behavior or can someone validate if my theory is true?

    Read the article

  • How to determine which version of Oracle Client is being used from the server.

    - by Robert Love
    Using Oracle 10g. ( 10.2.0.4 ) Possibly by looking at either logs or system tables is there a way to determine which version of the oracle client each connection is using. Our systems initially had 8.1.7 Clients, and then 9.X clients. We attempted to manually locate all machines that had older clients and upgrade them to to 10.2 Clients. We are seeking a method to audit (from the server) if we were successful in upgrading all of our client machines.

    Read the article

  • Oracle export problem

    - by Abhiram
    I use exp username/password@servername owner={ownername} file=backuppath; The parameters given are correct but still not able to connect Below is the error trace: EXP-00056: ORACLE error 12545 encountered ORA-12545: Connect failed because target host or object does not exist EXP-00000: Export terminated unsuccessfully What can be the possible reasons?

    Read the article

  • Why my oracleParameter doesnt work?

    - by user1824356
    I'm a .NET developer and this is the first time i work with oracle provider (Oracle 10g and Framework 4.0). When i add parameter to my command in this way: objCommand.Parameters.Add("pc_cod_id", OracleType.VarChar, 4000).Value = codId; objCommand.Parameters.Add("pc_num_id", OracleType.VarChar, 4000).Value = numId; objCommand.Parameters.Add("return_value", OracleType.Number).Direction = ParameterDirection.ReturnValue; objCommand.Parameters.Add("pc_email", OracleType.VarChar, 4000).Direction = ParameterDirection.Output; I have no problem with the result. But when a add parameter in this way: objCommand.Parameters.Add(CreateParameter(PC_COD_ID, OracleType.VarChar, codId, ParameterDirection.Input)); objCommand.Parameters.Add(CreateParameter(PC_NUM_ID, OracleType.VarChar, numId, ParameterDirection.Input)); objCommand.Parameters.Add(CreateParameter(RETURN_VALUE, OracleType.Number, ParameterDirection.ReturnValue)); objCommand.Parameters.Add(CreateParameter(PC_EMAIL, OracleType.VarChar, ParameterDirection.Output)); The implementation of that function is: protected OracleParameter CreateParameter(string name, OracleType type, ParameterDirection direction) { OracleParameter objParametro = new OracleParameter(name, type); objParametro.Direction = direction; if (type== OracleType.VarChar) { objParametro.Size = 4000; } return objParametro; } All my result are a empty string. My question is, these way to add parameters are not the same? And if no, what is the difference? Thanks :) Add: Sorry i forgot mention "CreateParameter" is a function with multiple implementations the base is the above function, the other use that. protected OracleParameter CreateParameter(string name, OracleType type, object value, ParameterDirection direction) { OracleParameter objParametro = CreateParameter(name, type, value); objParametro.Direction = direction; return objParametro; } The last parameters doesn't need value because those are output parameter, those bring me data from the database.

    Read the article

  • EXECUTE IMMEDIATE

    - by user578332
    Hi. I want to create table like this: create table ttt ( col1 varchar2(2), col2 varchar2(2), col3 varchar2(2), col4 varchar2(2), col5 varchar2(2) ); with this procedure, but it does not work. May you help me? declare str varchar2(200); i int; begin for i in 1 .. 5 loop begin str:=’str’||i||”; end; end loop; execute immediate ‘create table t1 (“str” varchar2(2) )’; end; / Thanks in advance.

    Read the article

  • alternative to lag SQL command

    - by mahen
    I have a table which has a table like this. Month-----Book_Type-----sold_in_Dollars Jan----------A------------ 100 Jan----------B------------ 120 Feb----------A------------ 50 Mar----------A------------ 60 Mar----------B------------ 30 and so on I have to calculate the expected sales for each month and book type based on the last 2 months sales. So for March and type A it would be (100+50)/2 = 75 For March and type B it is 120/1 since no data for Feb is there. I was trying to use the lag function but it wouldn't work since there is data missing in a few rows. Any ideas on this?

    Read the article

  • Oracle Extended Stored Procedure with C++

    - by BeginnerAmongBeginners
    I am currently adding Oracle 10.2.0. as a viable database to a product. The product originally allows connection to SQL Server and I have found some extended stored procedures. Is it possible to produce similar extended stored procedures for Oracle with C++? If so, how do I accomplish this? Example code would be much appreciated.

    Read the article

  • Selecting a sequence NEXTVAL for multiple rows

    - by stringpoet
    I am building a SQL Server job to pull data from SQL Server into an Oracle database through a linked server. The table I need to populate has a sequence for the name ID, which is my primary key. I'm having trouble figuring out a way to do this simply, without some lengthy code. Here's what I have so far for the SELECT portion (some actual names obfuscated): SELECT (SELECT NEXTVAL FROM OPENQUERY(MYSERVER, 'SELECT ORCL.NAME_SEQNO.NEXTVAL FROM DUAL')), psn.BirthDate, psn.FirstName, psn.MiddleName, psn.LastName, c.REGION_CODE FROM Person psn LEFT JOIN MYSERVER..ORCL.COUNTRY c ON c.COUNTRY_CODE = psn.Country MYSERVER is the linked Oracle server, ORCL is obviously the schema. Person is a local table on the SQL Server database where the query is being executed. When I run this query, I get the same exact value for all records for the NEXTVAL. What I need is for it to generate a new value for each returned record. I found this similar question, with its answers, but am unsure how to apply it to my case (if even possible): Query several NEXTVAL from sequence in one satement

    Read the article

  • if not (i_ReLaunch = 1 and (dt_enddate is not null)) How this epression will be evaluated in Oracle

    - by Phani Kumar PV
    if not (i_ReLaunch = 1 and (dt_enddate is not null)) How this epression will be evaluated in Oracle 10g when the input value of the i_ReLaunch = null and the value of the dt_enddate is not null it is entering the loop. according to the rules in normal c# and all it should not enter the loop as it will be as follows with the values. If( not(false and (true)) = if not( false) =if( true) which implies it should enters the loop But it is not happening Can someone let me know if i am wrong at any place

    Read the article

< Previous Page | 5 6 7 8 9 10  | Next Page >