Oracle9i 인스톨후의 interMedia 를 이용한 SQL...(xpath.extract)

* 질문한 사람 : atopos
* 질문 등록일 : 2001-10-13 18:43:39
* 조회 : 46904
* 답변 : 3건 (Rainman1, atopos)
-- 질문 내용 --
안녕하세요 ^^
Oracle9iAS를 인스톨했습니다.
그리고 다음과 같은 테이블을 만들고,
interMedia 를 이용해서 index를 만들고 SQL문을 실행하면 되는데..
SELECT 절에 xpath를 사용하면 Oracle8i 에서와 같이 에러가 발생합니다. ^^;;;
이것때문에 Oralce 9i를 인스톨했는데...
테이블을 다음과 같이 만들었습니다.
..... xml_documents .....................
DOCNAME NOT NULL VARCHAR2(200)
XMLDOC CLOB
TIMESTAMP DATE
위와 같이 테이블이 구성되어 있는 경우
SQL> select docname, xpath.extract(xmldoc, '//Alien') as title
2 from xml_documents
3 where contains(xmldoc, 'Alien within Title') > 0;
select docname, xpath.extract(xmldoc, '//Alien') as title
ERROR at line 1:
ORA-00904: invalid column name
갑자기 너무 난감해지네요. ^^;;;
SELECT docname
FROM xml_documents
WHERE CONTAINS(xmldoc, 'Alien') >0 과 같은 SQL 문은 실행됩니다.
어떻게 해야 할까요....
-- 답변 내용 --
1. Rainman1 님의 답변
intermedia를 사용하시는게 아니라,
9i를 install하셨으니 sys.XMLType을 이용하시는 겁니다.
예를들어보이면..
1) 테이블 생성(xml doc의 데이타 타입은 sys.xmltype)
create table sample ( .... xmldoc sys.xmltype);
2) xml document insert
insert into sample values (.. sys.xmltype.createxml('<?xml ver..') );
3) select xmldoc.getclobval() from sample;
rownum 1 - xmldoc컬럼 첫째 로우에 들어있는 xml document
rownum 2 - xmldoc컬럼 둘째 로우에 들어있는 xml document
4) xpath로 해당 데이터를 찾아오기
select xmldoc.extract('/rowset/row/col1').getclobval() from sample
추가로, xmldoc형태로 저장하는 부분은 가급적이면 피해야 하기 때문에,
일정형식을 취하는 형태라면 flat하게 매 컬럼을 쪼개서
멀티테이블에 저장하는 형태가 아무래도 좋을 듯이 보여집니다.
또 다르게, Node table을 만들고 이에 대한 Nodelist를 가지는 table을
만들어서 검색하는 형태도 괜찮습니다.
현재의 xml 추세가 그렇지만, 구분되어 있는 xml관련 util을
모두 데이터베이스로 stored package, procedure 형태로 넣고 있답니다.
xsu for java가 아니라 xml for pl/sql을 기본으로 add on시키고,
사용자는 xml을 쓰는지 모르는지 모르게 DB를 이용하게 하는 형태로 가는거죠.
Oracle, MS-SQL, DB2가 그렇게 가고 있고,
Sybase만 아직은 별개로 java util로 지원하지만,
조만간 DB통합할 것으로 생각됩니다.
RDB측면에서는 이게 당연하고, 성능도 잘 나오긴 하겠지만,
반드시 옳다고 생각되지는 않습니다. 아무래도 rdb위에 얹은 xml에 대한
모델링에 대해 적합한 지침과 같은 부분이 각 밴더마다 있어야 하지 않을지..
Co. Dasan tech.
DB연구팀 권용훈
e-mail : [email protected]
2. atopos 님의 답변
otn.oracle.com 에서 Oracle9i의 XMLtype에 대한 document를 읽으면서
성급하게 질문을 올렸구나 생각했습니다. ^^;;;
아직 document를 읽어보면서 실행해보고 테스트 중이지만
제가 필요한 기능들을 찾아볼수 있을것 같습니다. ^^
Rainman1(권용훈님) 의견 고맙습니다. ^________^
xsu for java, xml for pl/sql 에 대해서는 맛보기만 한 상태라
아직 잘 모르는 상태입니다.
그리고 궁금한 점이 또~ 있습니다.
이건 XML과 관련있는 것은 아닌데 (다른 포럼에도 올리긴 했지만요.)...
resin servlet engine 을 설치하여 사용하려고 하는데
resin을 start한 후 http://localhost:8080/ 을 실행하면
resin 의 servlet engine 이 실행되는 것이 아니라
Oracle servlet engine 이 실행됩니다.
어떤 서비스를 중지시켜야 하는지 잘 모르겠습니다.
OralcleOraHome90Agent 를 중지시켜도 그대로구요.
현재 실행중인 서비스는 OracleOraHome90TNSListener와
OracleServiceORA90 입니다.
혹... Oracle9i 에서는 servlet engine을 Oracle servlet engine을
사용해야 하는 건가요?
다른 엔진은 사용할수 없는건지...
Oracle 8i 에서는 resin 을 사용했었는데 Oracle9i 로 가니
잘 모르겠네요. ^^;;;

Similar Messages

  • CASE STATEMENTS AND CASE EXPRESSIONS IN ORACLE9I PL/SQL

    제품 : PL/SQL
    작성날짜 : 2001-11-13
    CASE STATEMENTS AND CASE EXPRESSIONS IN ORACLE9I PL/SQL
    =======================================================
    PURPOSE
    아래의 자료는 Case 문에서 oracle 8.1.7과 Oracle 9i의 New Feature로 8.1.7에서는
    sqlplus 에서만 가능했고, 9i 부터는 pl/sql 까지 가능하다.
    Explanation
    1. Oracle 8.1.7 Feature
    Oracle 8.1.7 에서 Case 문은 Decode 문과 유사하지만, 기존의 decode 문을 쓰는 것보다
    더 많은 확장성과 Logical Power와 좋은 성능을 제공한다. 주로 나이와 같이 category 별로
    나눌때 주로 사용하고 Syntex는 아래와 같다.
    CASE WHEN <cond1> THEN <v1> WHEN <cond2> THEN <v2> ... [ELSE <vn+1> ] END
    각각의 WHEN...THEN 절의 argument 는 255 까지 가능하고 이 Limit를 해결하려면
    Oracle 8i Reference를 참조하면 된다.
    The maximum number of arguments in a CASE expression is 255, and each
    WHEN ... THEN pair counts as two arguments. To avoid exceeding the limit of 128 choices,
    you can nest CASE expressions. That is expr1 can itself be a CASE expression.
    Case Example : 한 회사의 모든 종업원의 평균 봉급을 계산하는데 봉급이 $2000보다 작은경우
    2000으로 계산을 하는 방법이 pl/sql을 대신하여 case function을 사용할 수 있다.
    SELECT AVG(CASE when e.sal > 2000 THEN e.sal ELSE 2000 end) FROM emp e;
    Case Example : 나이를 column으로 가지고 있는 customer table을 예로 들어보자.
    SQL> SELECT
    2 SUM(CASE WHEN age BETWEEN 70 AND 79 THEN 1 ELSE 0 END) as "70-79",
    3 SUM(CASE WHEN age BETWEEN 80 AND 89 THEN 1 ELSE 0 END) as "80-89",
    4 SUM(CASE WHEN age BETWEEN 90 AND 99 THEN 1 ELSE 0 END) as "90-99",
    5 SUM(CASE WHEN age > 99 THEN 1 ELSE 0 END) as "100+"
    6 FROM customer;
    70-79 80-89 90-99 100+
    4 2 3 1
    1 SELECT
    2 (CASE WHEN age BETWEEN 70 AND 79 THEN '70-79'
    3 WHEN age BETWEEN 80 and 89 THEN '80-89'
    4 WHEN age BETWEEN 90 and 99 THEN '90-99'
    5 WHEN age > 99 THEN '100+' END) as age_group,
    6 COUNT(*) as age_count
    7 FROM customer
    8 GROUP BY
    9 (CASE WHEN age BETWEEN 70 AND 79 THEN '70-79'
    10 WHEN age BETWEEN 80 and 89 THEN '80-89'
    11 WHEN age BETWEEN 90 and 99 THEN '90-99'
    12* WHEN age > 99 THEN '100+' END)
    SQL> /
    AGE_G AGE_COUNT
    100+ 1
    70-79 4
    80-89 2
    90-99 3
    Example
    2. Oracle 9i Feature
    Oracle 9i부터는 pl/sql에서도 case문을 사용할 수 있으면 이것은
    복잡한 if-else 구문을 없애고, C언어의 switch문과 같은 기능을 한다.
    아래의 9i pl/sql Sample 및 제약 사항을 보면 아래와 같다.
    Sample 1:
    A simple example demonstrating the proper syntax for a case
    statement
    using a character variable as the selector. See the section entitled
    'Restrictions' at the end of this article for details on which PLSQL
    datatypes may appear as a selector in a case statement or
    expression.
    - - - - - - - - - - - - - - - - Code begins here - - - - - - - - - - - -
    set serveroutput on
    declare
    achar char(1) := '&achar';
    begin
    case achar
    when 'A' then dbms_output.put_line('The description was Excellent');
    when 'B' then dbms_output.put_line('The description was Very Good');
    when 'C' then dbms_output.put_line('The description was Good');
    when 'D' then dbms_output.put_line('The description was Fair');
    when 'F' then dbms_output.put_line('The description was Poor');
    else dbms_output.put_line('The description was No such Grade');
    end case;
    end;
    - - - - - - - - - - - - - - - - Code ends here - - - - - - - - - - - -
    Sample 2:
    A simple example demonstrating the proper syntax for a case
    expression
    using a character variable as the selector. See the section entitled
    'Restrictions' at the end of this article for details on which PLSQL
    datatypes may appear as a selector in a case statement or
    expression.
    - - - - - - - - - - - - - - - - Code begins here - - - - - - - - - - - -
    set serveroutput on
    declare
    achar char(1) := '&achar';
    description varchar2(20);
    begin
    description :=
    case achar
    when 'A' then 'Excellent'
    when 'B' then 'Very Good'
    when 'C' then 'Good'
    when 'D' then 'Fair'
    when 'F' then 'Poor'
    else 'No such grade'
    end;
    dbms_output.put_line('The description was ' || description);
    end;
    - - - - - - - - - - - - - - - - Code ends here - - - - - - - - - - - -
    NOTE: The above simple samples demonstrate two subtle differences in the
    syntax
    required for case statements and expressions.
    1) A case STATEMENT is terminated using the 'end case' keywords; a
    case
    EXPRESSION is terminated using only the 'end' keyword.
    2) Each item in a case STATEMENT consists of one or more
    statements, each
    terminated by a semicolon. Each item in a case expression
    consists of
    exactly one expression, not terminated by a semicolon.
    Sample 3:
    Sample 1 demonstrates a simple case statement in which the selector
    is
    compared for equality with each item in the case statement body.
    PL/SQL
    also provides a 'searched' case statement as an alternative; rather
    than
    providing a selector and a list of values, each item in the body of
    the
    case statement provides its own predicate. This predicate can be any
    valid boolean expression, but only one case will be selected.
    - - - - - - - - - - - - - - - - Code begins here - - - - - - - - - - - -
    set serveroutput on
    declare
    achar char(1) := '&achar';
    begin
    case
    when achar = 'A' then dbms_output.put_line('The description was
    Excellent');
    when achar = 'B' then dbms_output.put_line('The description was Very
    Good');
    when achar = 'C' then dbms_output.put_line('The description was
    Good');
    when achar = 'D' then dbms_output.put_line('The description was
    Fair');
    when achar = 'F' then dbms_output.put_line('The description was
    Poor');
    else dbms_output.put_line('The description was No such Grade');
    end case;
    end;
    - - - - - - - - - - - - - - - - Code ends here - - - - - - - - - - - -
    Sample 4:
    This sample demonstrates the proper syntax for a case expression of
    the
    type discussed in Sample 3 above.
    - - - - - - - - - - - - - - - - Code begins here - - - - - - - - - - - -
    set serveroutput on
    declare
    achar char(1) := '&achar';
    description varchar2(20);
    begin
    description :=
    case
    when achar = 'A' then 'Excellent'
    when achar = 'B' then 'Very Good'
    when achar = 'C' then 'Good'
    when achar = 'D' then 'Fair'
    when achar = 'F' then 'Poor'
    else 'No such grade'
    end;
    dbms_output.put_line('The description was ' || description);
    end;
    - - - - - - - - - - - - - - - - Code ends here - - - - - - - - - - - -
    Sample 5:
    This sample demonstrates the use of nested case statements. It is
    also
    permissable to nest case expressions within a case statement (though
    it
    is not demonstrated here), but nesting of case statements within a
    case
    expression is not possible since statements do not return any value.
    - - - - - - - - - - - - - - - - Code begins here - - - - - - - - - - - -
    set serveroutput on
    declare
    anum1 number := &anum1;
    anum2 number := &anum2;
    answer number;
    begin
    case anum1
    when 1 then case anum2
    when 1 then answer := 10;
    when 2 then answer := 20;
    when 3 then answer := 30;
    else answer := 999;
    end case;
    when 2 then case anum2
    when 1 then answer := 15;
    when 2 then answer := 25;
    when 3 then answer := 35;
    else answer := 777;
    end case;
    else answer := 555;
    end case;
    dbms_output.put_line('The answer is ' || answer);
    end;
    - - - - - - - - - - - - - - - - Code ends here - - - - - - - - - - - -
    Sample 6:
    This sample demonstrates nesting of case expressions within another
    case
    expression. Note again the absence of semicolons to terminate both
    the
    nested case expression and the individual cases of those
    expressions.
    - - - - - - - - - - - - - - - - Code begins here - - - - - - - - - - - -
    set serveroutput on
    declare
    anum1 number := &anum1;
    anum2 number := &anum2;
    answer number;
    begin
    answer :=
    case anum1
    when 1 then case anum2
    when 1 then 10
    when 2 then 20
    when 3 then 30
    else 999
    end
    when 2 then case anum2
    when 1 then 15
    when 2 then 25
    when 3 then 35
    else 777
    end
    else 555
    end;
    dbms_output.put_line('The answer is ' || answer);
    end;
    - - - - - - - - - - - - - - - - Code ends here - - - - - - - - - - - -
    Although PL/SQL anonymous blocks have been used in all of the examples
    so far,
    case statements and expressions can also be used in procedures,
    functions, and
    packages with no changes to the syntax.
    The following samples are included for completeness and demonstrate the
    use of
    case statements and/or expressions in each of these scenarios.
    Sample 7:
    This sample demonstrates use of a case statement in a stored
    procedure.
    Note that this sample also demonstrates that it is possible for each
    of
    the items in the case body to consist of more than one statement.
    - - - - - - - - - - - - - - - - Code begins here - - - - - - - - - - - -
    set serveroutput on
    create or replace procedure testcasestmt ( anum IN number ) is
    begin
    case
    when anum = 1 then dbms_output.put_line('The number was One');
    dbms_output.put_line('In case 1');
    when anum = 2 then dbms_output.put_line('The number was Two');
    dbms_output.put_line('In case 2');
    when anum = 3 then dbms_output.put_line('The number was Three');
    dbms_output.put_line('In case 3');
    when anum = 4 then dbms_output.put_line('The number was Four');
    dbms_output.put_line('In case 4');
    when anum = 5 then dbms_output.put_line('The number was Five');
    dbms_output.put_line('In case 5');
    else dbms_output.put_line('The description was Invalid input');
    dbms_output.put_line('In the else case');
    end case;
    end;
    exec testcasestmt(&anum);
    - - - - - - - - - - - - - - - - Code ends here - - - - - - - - - - - -
    Sample 8:
    This sample demonstrates the use of a case statement in a stored
    package.
    - - - - - - - - - - - - - - - - Code begins here - - - - - - - - - - - -
    set serveroutput on
    create or replace package testpkg2 is
    procedure testcasestmt ( anum IN number );
    function testcasestmt_f ( anum IN number ) return number;
    end testpkg2;
    create or replace package body testpkg2 is
    procedure testcasestmt ( anum IN number ) is
    begin
    case
    when anum = 1 then dbms_output.put_line('The number was One');
    dbms_output.put_line('In case 1');
    when anum = 2 then dbms_output.put_line('The number was Two');
    dbms_output.put_line('In case 2');
    when anum = 3 then dbms_output.put_line('The number was Three');
    dbms_output.put_line('In case 3');
    when anum = 4 then dbms_output.put_line('The number was Four');
    dbms_output.put_line('In case 4');
    when anum = 5 then dbms_output.put_line('The number was Five');
    dbms_output.put_line('In case 5');
    else dbms_output.put_line('The description was Invalid input');
    dbms_output.put_line('In the else case');
    end case;
    end;
    function testcasestmt_f ( anum IN number ) return number is
    begin
    case
    when anum = 1 then dbms_output.put_line('The number was One');
    dbms_output.put_line('In case 1');
    when anum = 2 then dbms_output.put_line('The number was Two');
    dbms_output.put_line('In case 2');
    when anum = 3 then dbms_output.put_line('The number was Three');
    dbms_output.put_line('In case 3');
    when anum = 4 then dbms_output.put_line('The number was Four');
    dbms_output.put_line('In case 4');
    when anum = 5 then dbms_output.put_line('The number was Five');
    dbms_output.put_line('In case 5');
    else dbms_output.put_line('The description was Invalid input');
    dbms_output.put_line('In the else case');
    end case;
    return anum;
    end;
    end testpkg2;
    exec testpkg2.testcasestmt(&anum);
    variable numout number
    exec :numout := testpkg2.testcasestmt_f(&anum);
    print numout
    - - - - - - - - - - - - - - - - Code ends here - - - - - - - - - - - -
    Sample 9:
    This sample demonstrates the use of a case expression in a stored
    package.
    - - - - - - - - - - - - - - - - Code begins here - - - - - - - - - - - -
    set serveroutput on
    create or replace package testpkg is
    procedure testcase ( anum IN number );
    function testcase_f ( anum IN number ) return number;
    end testpkg;
    create or replace package body testpkg is
    procedure testcase ( anum IN number ) is
    anumber number := anum;
    anothernum number;
    begin
    anothernum :=
    case
    when anumber = 1 then anumber + 1
    when anumber = 2 then anumber + 2
    when anumber = 3 then anumber + 3
    when anumber = 4 then anumber + 4
    when anumber = 5 then anumber + 5
    else 999
    end;
    dbms_output.put_line('The number was ' || anothernum);
    end;
    function testcase_f ( anum IN number ) return number is
    anumber number := anum;
    anothernum number;
    begin
    anothernum :=
    case
    when anumber = 1 then anumber + 1
    when anumber = 2 then anumber + 2
    when anumber = 3 then anumber + 3
    when anumber = 4 then anumber + 4
    when anumber = 5 then anumber + 5
    else 999
    end;
    dbms_output.put_line('The number was ' || anothernum);
    return anothernum;
    end;
    end testpkg;
    variable numout number
    exec testpkg.testcase(&anum);
    exec :numout := testpkg.testcase_f(&anum);
    print numout
    - - - - - - - - - - - - - - - - Code ends here - - - - - - - - - - - -
    제약 사항
    다음의 databasetype은 case 문에서 지원되지 않는다.
    BLOB
    BFILE
    VARRAY
    Nested Table
    PL/SQL Record
    PL/SQL Version 2 tables (index by tables)
    Object type (user-defined type)
    All of these types except for object types face a similar restriction
    even for if statements (i.e. they cannot be compared for equality directly) so this is unlikely to change for these types. Lack of support for object types is simply an implementation restriction which may be relaxed in future releases.
    Reference Ducumment
    Oracle 8.1.7 Manual
    NOTE:131557.1

    I have done the following code but doesn't
    like the statement of - "case(butNext)". What do you mean "doesn't like" -- did you get an error message?
    I'm guessing it won't compile because you're trying to switch on a Button.
    I tried something
    like "g.fillOval(100,50,70,90, BorderLayout.NORTH)"...no that doesn't make sense. You only use BorderLayout.NORTH when you're adding components to a BorderLayout layout manager. An oval is not a component and fillOval isn't adding a component and Graphics is not a Panel or layout manager.
    Would appreciate it if someone could tell me how to position
    shapes using the graohic method. I think the problem is that you're confusing shapes with components.

  • Binding parameter to SQL/xpath query using java/jdbc

    I'm trying to execute a query containing an xpath.
    The query looks like this:
    select * FROM table  t where t.column.existsNode('/RootElement[contains(SubElement, "someVal")]/SubElement')In java replacing the "someVal" with a bind parameter "?" will not work:
    PreparedStatement ps = c.prepareStatement("select * FROM table t where t.column.existsNode('/RootElement[contains(SubElement, ? )]/SubElement') = 1");
    ps.setString(1,"someVal");
    =EXCEPTIONOn this forum I found that you can also use '||:namedParam||'
    So the query in java would be executed like;
    PreparedStatement ps = c.prepareStatement("select * FROM table t where t.column.existsNode('/RootElement[contains(SubElement, '||:1||' )]/SubElement') = 1");
    ps.setString(1,"someVal");This seems to work (I have no idea what the '|| ||' construct does, I don't seem to find any info about it)
    HOWEVER, it seems that doing it this way the value being bound is NOT escaped.
    So, doing this will yield in an orcale SQL/xpath exception:
    ps.setString(1,"som'eVal");
    I've went to all the oracle xml manual stuff I could find, but nowhere do they address this.
    Any one an idea how I can bind the value and still have escaping ?
    Edited by: user5893566 on Nov 27, 2008 12:06 AM
    Edited by: user5893566 on Nov 27, 2008 12:15 AM

    Would you mind explain me what the replace actually does?The idea is like this:
    Let's start with a string like some'V"al and surround it by the concat function:
      '...concat("' || some'V"al || '") ....' {code}
    replace the inner (i.e. all) double quotes with +",''","+ to obtain '...concat("' || some'V",''"'',"al || '") ...' {code}
    So this concatenates three parts of the original string where the double quotes are now enclosed by two single quotes. The resulting string should look like
    {code} '...concat("some'V",''"'',"al") ...'i.e. first argument of concat is enclosed by double quotes, the second one by two single quotes and the third one again by double quotes.  This is just a rewritten form of our original string!.
    Now incorporate the whole thing in the xpath expression  as shown in my previous example and it should work ;)
    hth
    michael                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • SQL function extract

    Hello XML Guru,
    Could you tell me where i can find informations about how SQL function extract works for extracting XML data stored as relational-object?
    Is VIEW always created for extracting XML data when executing this SQL function extract?
    Thanks for your help.

    You'll find documentation on this function in the [Oracle XML DB Developer's Guide| http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14259/xdb03usg.htm#sthref336] .
    HTH
    Chris

  • SQL data extraction?

    Hi,
    can nay one here tell me what is SQL data extraction?
    in one on my requirements it was written simply SQL data extraction as flat file
    then modelling the data flow for the falt file to the BW.
    is it something related to database?
    explain me
    Thanks,
    Ravi

    Hi,
    it means that your flat file will be generated out of an database by SQL means (SQL = Structured Query Language).
    For instance your flat file will have the data returned by a statement like:
    SELECT FIELD1, FIELD2, FIELD3 FROM TABLE.
    The above is SQL but it can definitively be more complex (several tables, filters, grouping/aggregation...)
    Your flat file will then be loaded in your BW.
    Hope this helps...
    Olivier.

  • JDeveloper with Oracle9i intermedia

    How can i use oracle9i interMedia possibilities (such as retrieving audio/video data properties) and playing them in Jdeveloper.

    ok, thanx for the reply. I've seen that demo.
    The demo was intended for image data, are there any other intermedia JDeveloper for playing audio/video?
    Is there any other reference about intermedia in JDeveloper?

  • Sql for extract file path without file_name form the folumn value

    Dear Experts,
    can someone give the sql script to extract file path without file_name form the folumn value.
    can someome provide sql to extract only path in the column value.
    column value :
    /data/rrsapus/oradata22/rrsa_25122011rpsp_arpch.rsp
    i need output like this */data/rrsapus/oradata22/*

    Hi,
    Welcome to the forum!
    INSTR and SUBSTR is probably the most efficient way. Use INSTR to find where the last '/' is, and SUBSTR to get that many characters, starting from the beginning of the string.
    INSTR and SUBSTR (and REGEXP_SUBSTR, and REGEXP_REPLACE, and RTRIM, and REPLACE, and all the other bullt-in functions) are documented in the SQL language manual:
    http://docs.oracle.com/cd/B28359_01/server.111/b28286/index.htm
    REGEXP_SUBSTR or REGEXP_REPLACE would also do the job, perhaps with a little less code, but maybe not as efficiently.
    Here's a more creative way:
    SELECT     RTRIM ( str
               , REPLACE (str, '/')
               )          AS file_path
    FROM     table_x
    ;What results do you want if str does not contain a '/'?

  • Using XPath with SQL to extract XML data

    Given data such as this one:
    <?xml version="1.0"?>
    <ExtendedData>
       <Parameter name="CALLHOLD"><BooleanValue>true</BooleanValue></Parameter>
      <Parameter xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="BARRING_PASSWORD" xsi:nil="true"/>
      <Parameter name="ALLCF"><BooleanValue>true</BooleanValue></Parameter>
      <Parameter name="RealProv"><BooleanValue>false</BooleanValue></Parameter>
    </ExtendedData>I normally use extractValue function as shown below for example to extract the value for the last parameter in the data above, e.g:
    select extractValue(extended_data,'/ExtendedData/Parameter[@name="RealProv"]/BooleanValue') "my_column_alias" from tableAny ideas on how I may return the value of the parameter xsi:nil from this node:
    <Parameter xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="BARRING_PASSWORD" xsi:nil="true"/>I'd like to extract the true in xsi:nil="true"...
    Thanks,
    Edited by: HouseofHunger on May 15, 2012 2:13 PM
    Edited by: HouseofHunger on May 15, 2012 2:13 PM

    Extractvalue() has a third parameter we can use to declare namespace mappings :
    SQL> with sample_data as (
      2    select xmltype('<?xml version="1.0"?>
      3  <ExtendedData>
      4    <Parameter name="CALLHOLD"><BooleanValue>true</BooleanValue></Parameter>
      5    <Parameter xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="BARRING_PASSWORD" xsi:nil="true"/>
      6    <Parameter name="ALLCF"><BooleanValue>true</BooleanValue></Parameter>
      7    <Parameter name="RealProv"><BooleanValue>false</BooleanValue></Parameter>
      8  </ExtendedData>') doc
      9    from dual
    10  )
    11  select extractvalue(
    12           doc
    13         , '/ExtendedData/Parameter[@name="BARRING_PASSWORD"]/@xsi:nil'
    14         , 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'
    15         )
    16  from sample_data
    17  ;
    EXTRACTVALUE(DOC,'/EXTENDEDDAT
    true
    If you're on 11.2.0.2 and up, extractvalue() is deprecated.
    One should use XMLCast/XMLQuery instead :
    SQL> with sample_data as (
      2    select xmltype('<?xml version="1.0"?>
      3  <ExtendedData>
      4    <Parameter name="CALLHOLD"><BooleanValue>true</BooleanValue></Parameter>
      5    <Parameter xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="BARRING_PASSWORD" xsi:nil="true"/>
      6    <Parameter name="ALLCF"><BooleanValue>true</BooleanValue></Parameter>
      7    <Parameter name="RealProv"><BooleanValue>false</BooleanValue></Parameter>
      8  </ExtendedData>') doc
      9    from dual
    10  )
    11  select xmlcast(
    12           xmlquery('/ExtendedData/Parameter[@name="BARRING_PASSWORD"]/@xsi:nil'
    13            passing doc
    14            returning content
    15           ) as varchar2(5)
    16         )
    17  from sample_data
    18  ;
    XMLCAST(XMLQUERY('/EXTENDEDDAT
    true
    Note : the xsi prefix is predefined when using Oracle XQuery, so in this case we don't have to declare it explicitly.
    Edited by: odie_63 on 15 mai 2012 15:23

  • SQL functions extract and XMLSequence for a one-to-many (1:N) relationship

    I have have the following XML document loaded into a XMLType table. I'd like to retrieve the lineitem id together with the purchaseorder id and report id. How would the query look like? I've tried a lot but this one-to-many relationship is killing me.
    Many thanks!
    <report id=...>
    <purchaseorder id=...>
    <lineitems>
    <lineitem id=...>...</lineitem>
    <lineitem id=...>...</lineitem>
    <lineitem id=...>...</lineitem>
    </lineitems>
    </purchaseorder>
    <purchaseorder id=...>
    <lineitems>
    <lineitem id=...>...</lineitem>
    </lineitems>
    </purchaseorder>

    You can easily modify the above query to your needs:
    SQL> with qry as (
      2  select t.column_value.extract('/report/@id') report_id,
      3         t.column_value.extract('/report/purchaseorder') purchaseorder,
      4         t.column_value.extract('/report/purchaseorder/lineitems/*') lineitems
      5  from table(xmlsequence(xmltype('<document>
      6                                    <chapter>
      7                                      <report id="1">
      8                                        <purchaseorder id="1">
      9                                          <lineitems>
    10                                            <lineitem id="1">Item 11</lineitem>
    11                                            <lineitem id="2">Item 12</lineitem>
    12                                            <lineitem id="3">Item 13</lineitem>
    13                                          </lineitems>
    14                                        </purchaseorder>
    15                                        <purchaseorder id="2">
    16                                          <lineitems>
    17                                            <lineitem id="1">Item 21</lineitem>
    18                                          </lineitems>
    19                                        </purchaseorder>
    20                                      </report>
    21                                      <report id="2">
    22                                        <purchaseorder id="1">
    23                                          <lineitems>
    24                                            <lineitem id="1">Item 31</lineitem>
    25                                            <lineitem id="2">Item 32</lineitem>
    26                                          </lineitems>
    27                                        </purchaseorder>
    28                                        <purchaseorder id="2">
    29                                          <lineitems>
    30                                            <lineitem id="1">Item 41</lineitem>
    31                                            <lineitem id="2">Item 42</lineitem>
    32                                          </lineitems>
    33                                        </purchaseorder>
    34                                      </report>
    35                                    </chapter>
    36                                  </document>'
    37  ).extract('/document/chapter/*'))) t)
    38  select q.report_id,
    39         q1.column_value.extract('/purchaseorder/@id') purchase_id,
    40         q2.column_value.extract('/lineitem/@id') lineitem_id,
    41         q2.column_value.extract('/lineitem/text()') lineitem
    42  from qry q,
    43       table(xmlsequence(q.purchaseorder)) q1,
    44       table(xmlsequence(q1.extract('/purchaseorder/lineitems/*'))) q2
    45  /
    REPORT_ID  PURCHASE_ID     LINEITEM_ID     LINEITEM
    1          1               1               Item 11
    1          1               2               Item 12
    1          1               3               Item 13
    1          2               1               Item 21
    2          1               1               Item 31
    2          1               2               Item 32
    2          2               1               Item 41
    2          2               2               Item 42
    8 rows selected.
    SQL>

  • OGG for SQL Server - Extract stops capturing - Bug?

    Hi, all,
    I've found a problem with OGG for SQL Server where the Extract stops capturing data after the transaction log is backed up. I've looked for ways to reconfigure OGG to avoid the problem but couldn't find any reference to options to workaround this problem. It seems to be a bug to me.
    My Extract configuration is as follows:
    EXTRACT ext1
    SOURCEDB mssql1
    TRANLOGOPTIONS NOMANAGESECONDARYTRUNCATIONPOINT
    EOFDELAY 60
    EXTTRAIL dirdat/e1
    TABLE dbo.TestTable;
    I'm using the EOFDELAY parameter for testing purposes only, since it's easy to reproduce the scenario that causes the issue when the extract polling is configured with longer intervals.
    When the Transaction Log backup runs, SQL Server marks all the virtual logs that are older than the primary and secondary truncation points as inactive (status = 0). These virtual logs can then be reused if required. They still contain change records, though, and OGG can read from then if required, before they are overwritten. This situation will never occur if we are not using SQL Replication and have the Extract configured with the parameter MANAGESECONDARYTRUNCATIONPOINT.
    However, I'm trying to simulate a scenario where OGG is used along SQL Replication and the extract is configured with the NOMANAGESECONDARYTRUNCATIONPOINT option. The situation that I've reproduced and caused the Extract to stop capturing is the follow sequence of events:
    1. Extract reads transaction log and capture change up to LSN X
    2. More change are made to the database and the LSN is incremented
    3. Log Reader reads Transaction Log, captures changes up to LSN X+Y and advances the secondary truncation point to that LSN
    4. A transaction log occurs, backs up all the active virtual logs, advances the primary truncation point to a LSN greater than LSN X+Y, and marks all the virtual logs with LSNs <= X+Y as inactive (status = 0)
    5. Changes continue to happen in the database consuming all the available inactive virtual logs and overwriting them.
    6. The extract wakes up again to capture more changes.
    At this point, the changes between LSNs X and X+Y are not in the Transaction Log anymore, but are available in the backups. From what I understood in the documentation the Extract should detect that situation and retrieve the changes from the Transaction Log backups. This, however, is not happening and the Extract becomes stuck. It still pools the transaction log at the configured interval query the log state with DBCC LOGINFO, but doesn't move forward anymore.
    If I stop and restart the Extract I can see from the trace that it does the right thing upon startup. It realises that it requires information that's missing from the logs, query MSDB for the available backups, and mine the backups to get the required LSNs.
    I would've thought the Extract should do the same during normal operation, without the need for a restart.
    Is this a bug or the normal operation of the Extract? Is there a way to configure it to avoid this situation without using NOMANAGESECONDARYTRUNCATIONPOINT?
    The following is the state of the Extract once it gets stuck. The last replicated change occurred at 2012-07-09 12:46:50.370000. All the changes after that, and there are many, were not captured until I restarted the Extract.
    GGSCI> info extract ext1, showch
    EXTRACT EXT1 Last Started 2012-07-09 12:32 Status RUNNING
    Checkpoint Lag 00:00:00 (updated 00:00:54 ago)
    VAM Read Checkpoint 2012-07-09 12:46:50.370000
    LSN: 0x0000073d:00000aff:0001, Tran: 0000:000bd922
    Current Checkpoint Detail:
    Read Checkpoint #1
    VAM External Interface
    Startup Checkpoint (starting position in the data source):
    Timestamp: 2012-07-09 11:41:06.036666
    LSN: 0x00000460:00000198:0004, Tran: 0000:00089b02
    Recovery Checkpoint (position of oldest unprocessed transaction in the data so
    urce):
    Timestamp: 2012-07-09 12:46:50.370000
    LSN: 0x0000073d:00000afd:0004, Tran: 0000:000bd921
    Current Checkpoint (position of last record read in the data source):
    Timestamp: 2012-07-09 12:46:50.370000
    LSN: 0x0000073d:00000aff:0001, Tran: 0000:000bd922
    Write Checkpoint #1
    GGS Log Trail
    Current Checkpoint (current write position):
    Sequence #: 14
    RBA: 28531192
    Timestamp: 2012-07-09 12:50:02.409000
    Extract Trail: dirdat/e1
    CSN state information:
    CRC: D2-B6-9F-B0
    CSN: Not available
    Header:
    Version = 2
    Record Source = A
    Type = 8
    # Input Checkpoints = 1
    # Output Checkpoints = 1
    File Information:
    Block Size = 2048
    Max Blocks = 100
    Record Length = 20480
    Current Offset = 0
    Configuration:
    Data Source = 5
    Transaction Integrity = 1
    Task Type = 0
    Status:
    Start Time = 2012-07-09 12:32:29
    Last Update Time = 2012-07-09 12:50:02
    Stop Status = A
    Last Result = 400
    Thanks!
    Andre

    It might be something simple (or maybe not); but the best/fastest way to troubleshoot this would be to have Oracle (GoldenGate) support review your configuration. There are a number of critical steps required to allow GG to interoperate with MS's capture API. (I doubt this is it, but is your TranLogOptions on one line? It looks like you have it on two , the way it's formatted here.)
    Anyway, GG support has seen it all, and can probably wrap this up quickly. (And if it was something simple -- or even a bug -- do post back here & maybe someone else can benefit from the solution.)
    Perhaps someone else will be able to provide a better answer, but for the most part troubleshooting this (ie, sql server) via forum tends to be a bit like doing brain surgery blindfolded.

  • Creating Database link from Oracle9i to SQL server 2000

    Pls how do I create connectivity from Oracle9i database to query a table in an SQL server 2000 database.
    Pls I need the necessary steps to take.
    Thanx

    There are 2 solutions that you can use:
    1) Transparent Gateway for SQL Server
    2) Generic Connectivity
    Generic Connectivity is free with the database but has less features than the Gateway. For Generic Connectivity you will need to obtain an ODBC driver.
    The steps for using the gateway are available in the gateway manual and the steps for using Generic Connectivity is available in Chap 7 of the Heterogeneous Connectivity Administrator's Guide.

  • SQL Server - Extract Error - OGG-00868  Supplemental logging is disabled

    Hello,
    We are trying to replicate from a SQL Server 2008 database to Oracle database, but when trying to start the extract process we are getting the following error message:
    OGG-00868 Supplemental logging is disabled for database 'GoldenGate'. To enable logging, perform the following: 1) Set 'trunc. log on chkpt.' to false. 2) Create a full backup of the database. Please refer to the "Oracle GoldenGate For Windows and UNIX Administration Guide" for details.
    I have read that for enabling the supplemental logging is enough to "add trandata table_name", and this is done, and the extract process we are using is the following:
    EXTRACT cap_or4
    SOURCEDB GoldenGate
    TRANLOGOPTIONS MANAGESECONDARYTRUNCATIONPOINT
    EXTTRAIL c:\GoldenGate\V28983-01-GG-111112-SQLServer-Windows-x64\dirdat\C4
    TABLE GoldenGate.dbo.DES_T1;
    And the 'trunc.log on chkpt' is set to false.
    We don’t know what else to do, or to check... does anyone have any idea?!
    Thank you very much, best regards,
    Araitz.-

    Have you followed all the process for installing as per the guide? clearly you missed something
    Please follow below steps.
    Installation & Configuration of Oracle GoldenGate for MS SQL Server:
    Pre-requisites:
    1.Change Data Capture (CDC) must be enabled for Oracle GoldenGate and will be enabled by Oracle GoldenGate by means of the ADD TRANDATA command.
    2.SQL Server source database must be set to use the full recovery model.
    3.Oracle GoldenGate does not support system databases.
    4.After the source database is set to full recovery, a full database backup must be taken.
    5.SQL Server 2008 ODBC/OLE DB: SQL Server Native Client 10.0 driver
    6.Oracle GoldenGate processes can use either Windows Authentication or SQL Server Authentication to connect to a database.
    7.Before installing Oracle GoldenGate on a Windows system, install and configure the Microsoft Visual C ++ 2005 SP1 Redistributable Package. Make certain it
    is the SP1 version of this package, and make certain to get the correct bit version for your server. This package installs runtime components of Visual C++
    Libraries. For more information, and to download this package, go to http://www.microsoft.com.
    Privileges:
    1.Required SQL Server privileges for Manager when using Windows authentication
    Extract(source system)
    BUILTIN\Administrators account must be a member of the SQL Server fixed server role System Administrators.
    Account must be a member of the SQL Server fixed server role System Administrators
    Replicat (target system)
    BUILTIN\Administrators account must be at least a member of the db_owner fixed database role of the target database.
    Account must be at least a member of the db_owner fixed database role of the target database.
    2.Required SQL Server privileges for Extract and Replicat when using SQL Server authentication
    Extract - Member of the SQL Server fixed server role System Administrators.
    Replicat - At least a member of the db_owner fixed database role of the target database.
    Downloading Oracle GoldenGate
    Download the appropriate Oracle GoldenGate build to each system that will be part of the Oracle GoldenGate configuration.
    1. Navigate to http://edelivery.oracle.com.
    2. On the Welcome page:
    --Select your language.
    --Click Continue.
    3. On the Export Validation page:
    --Enter your identification information.
    --Accept the Trial License Agreement (even if you have a permanent license).
    --Accept the Export Restrictions.
    --Click Continue.
    4. On the Media Pack Search page:
    --Select the Oracle Fusion Middleware Product Pack.
    --Select the platform on which you will be installing the software.
    --Click Go.
    5. In the Results List:
    --Select the Oracle GoldenGate Media Pack that you want.
    --Click Continue.
    6. On the Download page:
    --Click Download for each component that you want. Follow the automatic download
    process to transfer the mediapack.zip file to your system.
    Installing the Oracle GoldenGate files
    1. Unzip the downloaded file(s) by using WinZip or an equivalent compression product.
    2. Move the files in binary mode to a folder on the drive where you want to install Oracle GoldenGate. Do not install Oracle GoldenGate into a folder that contains spaces in its name, even if the path is in quotes. For example:
    C:\“Oracle GoldenGate” is not valid.
    C:\Oracle_GoldenGate is valid.
    3. From the Oracle GoldenGate folder, run the GGSCI program.
    4. In GGSCI, issue the following command to create the Oracle GoldenGate working
    directories.
    CREATE SUBDIRS
    a.Create the necessary working directories for GG.
    Source DB:
    GGSCI>create subdirs
    Target DB:
    GGSCI>create subdirs
    Install the GoldenGate Manager process
    1.Create a GLOBALS parameter file
    --Execute the following commands from the <install location>.
    GGSCI> EDIT PARAMS ./GLOBALS
    --In the text editor, type the following:
    MGRSERVNAME <mgr service>
    Using a GLOBALS file in each GoldenGate instance allows you to run multiple Managers as services on Windows. When the service is installed, the Manager name
    is referenced in GLOBALS, and this name will appear in the Windows Services control panel.
    Note! Check to ensure that the GLOBALS file has been added in the GoldenGate installation directory and that it does not have an extension.
    --Execute the following command to exit GGSCI.
    GGSCI> EXIT
    2. Install the Manager service
    Execute the following command to run GoldenGate’s INSTALL.EXE . This executable installs Manager as a Windows service and adds GoldenGate events to the
    Windows Event Viewer.
    Shell> INSTALL ADDSERVICE ADDEVENTS
    Note: Adding the Manager as a service is an optional step used when there are multiple environments on the same system or when you want to control the name
    of the manager for any reason.
    Configuring an ODBC connection
    A DSN stores information about how to connect to a SQL Server database through ODBC (Open Database Connectivity). Create a DSN on each SQL Server source
    and target system.
    NOTE: Replicat will always use ODBC to query the target database for metadata.
    To create a SQL Server DSN
    1. Run one of the following ODBC clients:
    --If using a 32-bit version of Oracle GoldenGate on a 64-bit system, create the DSN by running the ODBCAD32.EXE client from the %SystemRoot%\SysWOW64
    folder.
    --If using a 64-bit version of Oracle GoldenGate on a 64-bit system, create a DSN by running the default ODBCAD32.EXE client in Control Panel>Administrative
    Tools>Data Sources (ODBC).
    --If using a version of Oracle GoldenGate other than the preceding, use the default ODBC client in Control Panel>Administrative Tools>Data Sources (ODBC).
    2. In the ODBC Data Source Administrator dialog box of the ODBC client, select the System DSN tab, and then click Add.
    3. Under Create New Data Source, select the correct SQL Server driver as follows:
    --SQL Server 2000: SQL Server driver
    --SQL Server 2005: SQL Native Client driver
    --SQL Server 2008: SQL Server Native Client 10.0 driver
    4. Click Finish. The Create a New Data Source to SQL Server wizard is displayed.
    5. Supply the following:
    --Name: Can be of your choosing. In a Windows cluster, use one name across all nodes in the cluster.
    --Server: Select the SQL Server instance name.
    6. Click Next.
    7. For login authentication, select With Windows NT authentication using the network login ID for Oracle GoldenGate to use Windows authentication, or select
    With SQL Server authentication using a login ID and password entered by the user for Oracle GoldenGate to use database credentials. Supply login information
    if selecting SQL Server authentication.
    8. Click Next.
    9. If the default database is not set to the one that Oracle GoldenGate will connect to,
    click Change the default database to, and then select the correct name. Set the other
    settings to use ANSI.
    10. Click Next.
    11. Leave the next page set to the defaults.
    12. Click Finish.
    13. Click Test Data Source to test the connection.
    14. Close the confirmation box and the Create a New Data Source box.
    15. Repeat this procedure from step 1 on each SQL Server source and target system.
    Setting the database to full recovery model
    Oracle GoldenGate requires a SQL Server source database to be set to the full recovery model.
    To verify or set the recovery model
    1. Connect to the SQL Server instance with either Enterprise Manager for SQL Server 2000 or SQL Server Management Studio for SQL Server 2005 and 2008.
    2. Expand the Databases folder.
    3. Right-click the source database, and then select Properties.
    4. Select the Options tab.
    5. Under Recovery, set Model to Full if not already.
    6. If the database was in Simple recovery or never had a Full database backup, take a Fulldatabase backup before starting Extract.
    7. Click OK.
    Enabling supplemental logging
    These instructions apply to new installations of Oracle GoldenGate for all supported SQL Server versions. You will enable supplemental logging with the ADD
    TRANDATA command so that Extract can capture the information that is required to reconstruct SQL operations on the target. This is more information than
    what SQL Server logs by default.
    --SQL Server 2005 updated to CU6 for SP2 or later: ADD TRANDATA calls the sys.sp_extended_logging stored procedure.
    --SQL Server 2005 pre-CU6 for SP2: ADD TRANDATA creates the following:
    A replication publication named [<source database name>]: GoldenGate<source database name> Publisher. To view this publication, look under Replication>Local
    Publications in SQL Server Management Studio. This procedure adds the specified table to the publication as an article.
    A SQL Server Log Reader Agent job for the publication. This job cannot run concurrently with an Extract process in this configuration.
    --SQL Server 2008: ADD TRANDATA enables Change Data Capture (CDC) and creates a minimal Change Data Capture on the specified table.
    a.Oracle GoldenGate does not use the CDC tables other than as necessary to enablesupplemental logging.
    b.As part of enabling CDC, SQL Server creates two jobs per database: <dbname>_capture and <dbname>_cleanup. The <dbname>_capture job adjusts the secondary
    truncation point and captures data from the log to store in the CDC
    tables. The <dbname>_cleanup job ages and deletes data captured by CDC.
    c.Using the TRANLOGOPTIONS parameter with the MANAGESECONDARYTRUNCATIONPOINT option for Extract removes the <dbname_capture> job, preventing the overhead of
    the job loading the CDC tables.
    d.The alternative (using TRANLOGOPTIONS with NOMANAGESECONDARYTRUNCATIONPOINT) requires the SQL Server Agent to be running and requires the <dbname>_capture and <dbname>_cleanup jobs to be retained. You will probably need to adjust the <dbname>_cleanup data retention period if the default of three days is not acceptable for storage concerns.
    To enable supplemental logging
    1. On the source system, run GGSCI.
    2. Log into the database from GGSCI.
    DBLOGIN SOURCEDB <DSN>[, USERID <user>, PASSWORD <password>]
    Where:
    -- SOURCEDB <DSN> is the name of the SQL Server data source.
    -- USERID <user> is the Extract login and PASSWORD <password> is the password that is required if Extract uses SQL Server authentication.
    3. In GGSCI, issue the following command for each table that is, or will be, in the Extract configuration. You can use a wildcard to specify multiple table
    names, but not owner names.
    ADD TRANDATA <owner>.<table>
    NOTE:The Log Reader Agent job cannot run concurrently with the GoldenGate Extract process.
    4.Configuration
    a.Create and start manager on the source and the destination.
    Source DB:
    shell>ggsci
    GGSCI> edit params mgr
    PORT 7809
    DYNAMICPORTLIST 7900-7950
    DYNAMICPORTREASSIGNDELAY 5
    AUTOSTART ER *
    AUTORESTART ER *, RETRIES 3, WAITMINUTES 5, RESETMINUTES 30
    LAGCRITICALMINUTES 60
    LAGREPORTMINUTES 30
    PURGEOLDEXTRACTS c:\ogg\dirdat\T*, USECHECKPOINTS, MINKEEPFILES 10
    GGSCI> start manager
    GGSCI>info all
    b. Create the extract group on the source side:
    GGSCI> edit params EXT1
    Add the following lines to the new parameter file
    EXTRACT EXT1
    SOURCEDB <DSN>, USERID ogg, PASSWORD ogg@321!
    TRANLOGOPTIONS MANAGESECONDARYTRUNCATIONPOINT
    EXTTRAIL c:\ogg\dirdat\T1
    DISCARDFILE c:\ogg\dirrpt\EXT1.DSC, PURGE, MEGABYTES 100
    TABLE dbo.TCUSTMER;
    TABLE dbo.TCUSTORD;
    GGSCI>ADD EXTRACT EXT1, TRANLOG, BEGIN NOW
    GGSCI>ADD EXTTRAIL c:\ogg\dirdat\T1, EXTRACT EXT1, MEGABYTES 100
    GGSCI> edit params PMP1
    Add the following lines to the new parameter file
    EXTRACT PMP1
    SOURCEDB <DSN>, USERID ogg, PASSWORD ogg@321!
    PASSTHRU
    RMTHOST dr, MGRPORT 7810
    RMTTRAIL c:\ogg\dirdat\P1
    TABLE dbo.TCUSTMER;
    TABLE dbo.TCUSTORD;
    GGSCI> ADD EXTRACT PMP1, EXTTRAILSOURCE c:\ogg\dirdat\T1
    GGSCI> ADD EXTTRAIL c:\ogg\dirdat\P1, EXTRACT PMP1, MEGABYTES 100
    Target DB:
    ===========
    shell>ggsci
    GGSCI> edit params mgr
    PORT 7810
    AUTOSTART ER *
    AUTORESTART ER *, RETRIES 3, WAITMINUTES 5, RESETMINUTES 30
    LAGCRITICALMINUTES 60
    LAGREPORTMINUTES 30
    PURGEOLDEXTRACTS c:\ogg\dirdat\P*, USECHECKPOINTS, MINKEEPFILES 10
    GGSCI> start manager
    GGSCI>info all
    Create parameter file for replicat:
    GGSCI> edit params REP1
    REPLICAT REP1
    ASSUMETARGETDEFS
    TARGETDB <dsn>, USERID ogg@DR, PASSWORD ogg@321!
    DISCARDFILE c:\ogg\dirrpt\REP1.DSC, append, megabytes 100
    HANDLECOLLISIONS
    ASSUMETARGETDEFS
    MAP dbo.TCUSTMER, TARGET dbo.TCUSTMER;
    MAP dbo.TCUSTORD, TARGET dbo.TCUSTORD;
    GGSCI>ADD REPLICAT REP1, RMTTRAIL c:\ogg\dirdat\P1, nodbcheckpoint
    # Start extract and replicat:
    Source:
    GGSCI> start er *
    Destination:
    GGSCI> start er *Greetings,
    N K

  • Pl/sql to extract data  with form: extract data is a text file

    Hi dear all,
    to be straightforward here is the problem: we currenlty developing with oracle tools :" Developer Suite 10g version 10.1.2.0.2" an interface .
    Using oracle forms, we would like to program a command button that will be in charge of pooling the data from the database and offer the client to save it on his desktop. The extracted data should be a one single flat text file having a one single continuous row. and the data extracted are from a 10 g database( one table having one column(varchar2(240); and 192 rows );
    attached with this mail is ou current script link with the command " when-button-pressed"
    PROCEDURE EXTRACTION_FICHIER_FIC_BDF IS
    n_bouton number;
    LF$File CLIENT_TEXT_IO.FILE_TYPE;
    LC$Name Varchar2(100) ;
    LC$Fic Varchar2(100) ;
    LN$Lines Pls_integer := 0 ;
    LC$Line Varchar2(4000) ;
    -- cursor --
    Cursor C_CUR Is
    SELECT ENREGISTREMENT_BDF
    FROM ops$admO7.fic_bdf
    ORDER BY 1;
    BEGIN
    LC$Name := 'd:\AA1217.bdf';
    LC$Fic := WEBUTIL_FILE.FILE_SAVE_DIALOG
    'd:\',
    LC$Name,
    'Choisir l''emplacement du fichier à sauvegarder'
    If LC$Fic is null Then
    Return ;
    End if ;
    -- Open the file --
    Begin
    LF$File := CLIENT_TEXT_IO.FOPEN( LC$Fic, 'W');
    Exception
    when others then
    message( 'OPEN FILE ERROR ' || LC$Fic );
    raise form_trigger_failure;
    End ;
    -- Write the lines --
    For Cur In C_CUR Loop
    LC$Line := Cur.ENREGISTREMENT_BDF;
    CLIENT_TEXT_IO.PUT_LINE( LF$File, LC$Line ) ;
    LN$Lines := C_CUR%ROWCOUNT ;
    End loop ;
    -- Close the file --
    CLIENT_TEXT_IO.FCLOSE( LF$File ) ;
    set_alert_property('AL_MESSAGE',alert_message_text,'Export terminé avec succès');
    n_bouton :=show_alert('AL_MESSAGE');
    synchronize ;
    Exception
    When form_trigger_failure Then
    CLIENT_TEXT_IO.FCLOSE( LF$File ) ;
    Raise ;
    END;
    thanks if advance !!!!!

    Hello,
    what's your problem with this? You posted a lot of useful information like version infos and code (Hint: when you post code you can do this with the tags so it gets formated), but I cannot see what exactly is failing or behaving unexpected, so you might share that too ;)
    cheers                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • SQL to extract large data

    I am using sybase to extract contents of a table which contains 20,000 rows. The front end application needs to view all data but does not want the overhead of extracting all the data only to view part of the data.
    I am currently using the following to create a scrollable resultset....
    ResultSet rst = null;
    try {
         if (conn == null) connect();
    Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
    // Execution
    rst = stmt.executeQuery(strRequest);
    Will this be enough to scroll through the data or should I create a stored procedure using cursors to return 1000 rows at a time ?

    It should be enough. The driver will not read all data at once.
    kaj

  • Oracle9i Intermedia cannot set properties

    hai, i want to ask why Oracle9i in my server cant set properties for mp3 or wav (audio length can be recognized, but the value of mimetype and format is ???). but when i use another Oracle9i in another computer, i can. when i check with System.out.println (Java), the file uploaded with servlet, i use method OrdHttpUploadFile.getMimeType() its work (the output is "audio/mpeg") but when OrdAudio.getMimeType() its output is "???"
    any idea

    no exception at all
    i'm using Java servlet for upload and retrieve media, with JBoss as Application Server,
    this code is for upload:
    oracle.jdbc.driver.OracleCallableStatement insertAudio =
    (oracle.jdbc.driver.OracleCallableStatement)
    conn.prepareCall("BEGIN "+
    "INSERT INTO audiotab VALUES(1,:1,:2,:3,:4,:5,SYSDATE," +
    "ORDSYS.ORDAudio.init(),:6,:7,:8) " +
    "RETURN audioid INTO :9 ; END;");
    ... (fill bind variable)
    insertAudio.executeUpdate();
    oracle.jdbc.driver.OraclePreparedStatement selectAudio=
    (oracle.jdbc.driver.OraclePreparedStatement)
    conn.prepareStatement(
    "SELECT * FROM audiotab WHERE audioid=? FOR UPDATE ");
    ... (fill bind variable)
    oracle.jdbc.driver.OraclePreparedStatement updateAudio=
    (oracle.jdbc.driver.OraclePreparedStatement)
    conn.prepareStatement(
    "UPDATE audiotab SET audiofile=:1 WHERE audioid=:2");
    .... (fill bind variable)
    OracleResultSet rs=(OracleResultSet)selectAudio.executeQuery();
    if(rs.next())
    OrdAudio ord=(OrdAudio)rs.getCustomDatum(8,OrdAudio.getFactory());
    data.loadAudio(ord);
    formData.release();
    updateAudio.setCustomDatum(1,ord);
    updateAudio.setLong(2,audioid);
    updateAudio.executeUpdate();
    conn.commit();
    there is one thing that maybe weird (for me), when i'm using Toad from Quest Software, i look the ORDAudio, THERE IS audio/mpeg as its MIME type, and other properties was right, so what happen with this?? is it because of Java, Oracle, or web server, i'm using tomcat 4 before JBoss 4, and the result was same.
    and there is one thing that disturbing me, why method getCustomDatum() from OracleResultSet was deprecated, although it works but its annoying, is there other method to get the ORDAudio and other ORD.

Maybe you are looking for

  • SS DBE TechNet Guru News: October Winners Announced

    All the votes are in!  And below are the results for the TechNet Guru Awards, October 2014 !!!! For a full list of winners, see the full blog post, as runners up had to be removed from this post to fit the forum max length restrictions.  BizTalk Tech

  • My iphoto appears to be damaged or incomplete, any help?

    my iphoto appears to be damaged or incomplete, and I can't open it, what can I do? I Just try to upgraded it and this happens just after that. My mac version is 10.6.8 My iphoto 08'

  • Help with wrt310n n mode operation

    In n mode, i can connect to my laptop from the wireless router. However if I include wep or wpa-personal I cannot connect. the laptop is running vista. beacon int 75, DTIM 1, Frag 2306, RTS 2307 In G or mixed mode all works 54 mbps, but that defeats

  • HT3988 incorrect file number of hard disks

    Have done a disk utility this morning and it comes back with 'this disk needs to be repaired.  Use the recovery HD'.

  • Can't see all of the Notification Center pane

    Hi, When I activate my notification center either by the menu bar icon or by the trackpad gesture, my desktop only slides over about a quarter of an inch, where I can see the background of the N.C. and the right most quarter inch of each of the notif