Beginning PL/sql Need help

I have around 120 slightly different text files. I was hoping to be able to read
Specific data from each then design a re-useable process to import into an oracle table.
Can anybody advise me of the most appropriate method? If there is some example code
That can help me that would be magnificent. Thank you in advance.
Neil

SqlLdr is a utility that enables you to load data into tables.
Examples:
Loading variable length
LOAD DATA
INFILE *
INTO TABLE dept
FIELDS TERMINATED BY , OPTIONALLY ENCLOSED BY "
(deptno, dname, loc)
BEGINDATA
12,RESEARCH,"SARATOGA"
10,"ACCOUNTING",CLEVELAND
11,"ART",SALEM
13,FINANCE,"BOSTON"
loading a fixed format file
LOAD DATA
INFILE ulcase2.dat
INTO TABLE emp
(empno POSITION(01:04) INTEGER EXTERNAL,
ename POSITION(06:15) CHAR,
job POSITION(17:25) CHAR,
mgr POSITION(27:30) INTEGER EXTERNAL,
sal POSITION(32:39) DECIMAL EXTERNAL,
comm POSITION(41:48) DECIMAL EXTERNAL,
deptno POSITION(50:51) INTEGER EXTERNAL)
Loading a Delimited, free format
LOAD DATA
INFILE *
APPEND
INTO TABLE emp
FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY "
(empno, ename, job, mgr,
hiredate DATE(20) "DD-Month-YYYY",
sal, comm, deptno CHAR TERMINATED BY :,
projno,
loadseq SEQUENCE(MAX,1))
BEGINDATA
7782, "Clark", "Manager", 7839, 09-June-1981, 2572.50,, 10:101
7839, "King", "President", , 17-November-1981,5500.00,,10:102
7934, "Miller", "Clerk", 7782, 23-January-1982, 920.00,, 10:102

Similar Messages

  • New to PL/SQL needs help?

    I am new to PL/SQL and i want to write a procedure to display the fields returned by the select statement by the procedure to display on the Web Page.
    Here i have written a small procedure to display fields on the web page.
    Create or Replace procedure Try(id number) is
    Begin
    select ename,empno,job,sal from emp where empno=id;
    end Try;
    Can i call this procedure instead of writting the SQL Code in Java for displaying the ename,empno,job,sal.

    I am new to PL/SQL and i want to write a procedure to
    display the fields returned by the select statement
    by the procedure to display on the Web Page.
    Here i have written a small procedure to display
    fields on the web page.
    Create or Replace procedure Try(id number) is
    Begin
    select ename,empno,job,sal from emp where empno=id;
    end Try;
    Can i call this procedure instead of writting the SQL
    Code in Java for displaying the ename,empno,job,sal.Nice and helpful, guys.
    Presumably you have a Java procedure that will call this procedure and display on the webpage. So you need to return the values to the Java. There are many ways to do this - you could have 1 OUT parameter for each column, or return a record, or a refcursor.
    Ideally, you'll get a PL/SQL developer to handle that end, or go on a course yourself.

  • Parse XML in PL/SQL need help

    Hi All,
    I'm new to PL/SQL. I need to call a web service from within the PL/SQL and then need to parse the response XML. I was able to call the web service and now I have returned SOAP response XML in CLOB. I searched on google for way to parse this XML and create some kind of list or array or collection with all the values so that later on that collection or array can be used in displaying the data or storing the data, but I couldn't found the right information, rather I got very confused.
    Please help me in parsing this XML and creating some kind collection or array for later use.
    Thanks
    XML is
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Header/>
    <SOAP-ENV:Body>
    <getMemberResponse effectiveDate="1970-10-01" endDate="2010-12-31" xmlns="http://abc.org/schema/Member/GetMember/V1">
    <responseHeader xmlns="http://abc.org/schema/common/v1">
    <serviceVersion>2.0.1</serviceVersion>
    <actionRequested AR="QUERY" xmlns:v1="http://abc.org/schema/Member/V1" xmlns:v11="http://abc.org/schema/common/v1" xmlns:v12="http://abc.org/schema/common/v1">
    <v11:transactionName>GetMemberRequest</v11:transactionName>
    </actionRequested>
    <requestResults>
    <resultStatus>Success</resultStatus>
    <resultCodes>
    <resultCode TYPE="HIPAA">00000</resultCode>
    <resultCode TYPE="LEGACY">00000</resultCode>
    <resultCode TYPE="SDI">00000</resultCode>
    </resultCodes>
    <resultMessage>Success</resultMessage>
    </requestResults>
    <accounting xmlns:v1="http://abc.org/schema/Member/V1" xmlns:v11="http://abc.org/schema/datatypes/v1" xmlns:v12="http://abc.org/schema/common/v1">
    <transactionId>ec3542e7-3191-430c-bd69-69dd5d18bf75</transactionId>
    <v12:timeStamp>2011-05-23T11:52:22</v12:timeStamp>
    </accounting>
    </responseHeader>
    <requestID>ec3542e7-3191-430c-bd69-69dd5d18bf75</requestID>
    <memberDetails xmlns:v1="http://abc.org/schema/Member/V1" xmlns:v11="http://abc.org/schema/datatypes/v1" xmlns:v12="http://abc.org/schema/common/v1">
    <v1:ids>
    <v1:id memberIdType="SSN">00000000</v1:id>
    <v1:id memberIdType="PARTYID">111111</v1:id>
    <v1:id memberIdType="PARTYNUMBER">222222</v1:id>
    </v1:ids>
    <v1:demographics>
    <v1:memberDemographicType effDate="2010-05-09" maintType="UPDATE">
    <v1:name>
    <v1:nameDetails>
    <v11:firstName>Keith</v11:firstName>
    <v11:middleName>M</v11:middleName>
    <v11:lastNames>
    <v11:lastName>
    <v11:name>Thompson</v11:name>
    </v11:lastName>
    </v11:lastNames>
    <v11:formattedName>Keith M Thompson</v11:formattedName>
    </v1:nameDetails>
    <v1:createDate>2010-05-09T14:23:17</v1:createDate>
    <v1:updateDate>2010-08-08T02:40:24</v1:updateDate>
    </v1:name>
    <v1:birthDate>1954-12-24</v1:birthDate>
    <v1:genderTypeCode>Male</v1:genderTypeCode>
    <v1:createDate>2010-05-09T14:23:17</v1:createDate>
    <v1:updateDate>2010-08-08T02:40:24</v1:updateDate>
    </v1:memberDemographicType>
    </v1:demographics>
    <v1:originalContractEffDate>2010-04-01</v1:originalContractEffDate>
    <v1:addresses>
    <v1:address maintType="QUERY">
    <v1:location addresseeType="MEMBER" effDate="1901-01-01" endDate="9999-12-31" locationUseType="HOME" primaryPerType="Y">
    <v11:addressLines>
    <v11:addressLine>BAY VIEW AVENUE</v11:addressLine>
    </v11:addressLines>
    <v11:cityName>PLYMOUTH</v11:cityName>
    <v11:stateCode>TX</v11:stateCode>
    <v11:postalCode>58654</v11:postalCode>
    </v1:location>
    <v1:createDate>2011-05-23T11:52:22</v1:createDate>
    <v1:updateDate>2011-05-23T11:52:22</v1:updateDate>
    </v1:address>
    <v1:address maintType="QUERY">
    <v1:location addresseeType="SUBSCRIBER" effDate="1901-01-01" endDate="9999-12-31" locationUseType="HOME" primaryPerType="Y">
    <v11:addressLines>
    <v11:addressLine>AY VIEW AVENUE</v11:addressLine>
    </v11:addressLines>
    <v11:cityName>PLYMOUTH</v11:cityName>
    <v11:stateCode>TX</v11:stateCode>
    <v11:postalCode>58654</v11:postalCode>
    </v1:location>
    <v1:createDate>2011-05-23T11:52:22</v1:createDate>
    <v1:updateDate>2011-05-23T11:52:22</v1:updateDate>
    </v1:address>
    </v1:addresses>
    <v1:policies>
    <v1:policy effDate="2010-04-01" maintType="ADD" type="MEMBER">
    <v1:ids>
    <v1:id type="MEMBERID">CPIT000456</v1:id>
    <v1:id type="POLICY">CPIT</v1:id>
    </v1:ids>
    <v1:contractType>F</v1:contractType>
    <v1:dependentType>01</v1:dependentType>
    <v1:offerings>
    <v1:offering offeredBy="abc" offeringIdType="INSURANCE_TYPE" selected="Y">
    <v1:offeringId>IV</v1:offeringId>
    </v1:offering>
    <v1:offering effDate="2010-04-01" maintType="ADD" offeredBy="abc" offeringIdType="BOC" selected="Y">
    <v1:offeringId>GK</v1:offeringId>
    <v1:recordInfo>
    <v1:internalRecId>82326287</v1:internalRecId>
    </v1:recordInfo>
    <v1:createDate>2010-05-09T14:23:17</v1:createDate>
    <v1:updateDate>2010-05-09T14:23:17</v1:updateDate>
    </v1:offering>
    </v1:offerings>
    <v1:customer>
    <v1:relation type="EMPLOYMENT">
    <v1:customer>
    <v1:id idType="ACCOUNTID">C11204</v1:id>
    <v1:id idType="DIVISION">0208290000</v1:id>
    <v1:customerName>BC Group</v1:customerName>
    </v1:customer>
    </v1:relation>
    </v1:customer>
    <v1:physicianRelations>
    <v1:physicianRelation effDate="2010-04-01" endDate="9999-12-31" type="PCP">
    <v1:ids>
    <v1:id type="NPI">0</v1:id>
    <v1:id type="AFFILIATIONID">1313 0025</v1:id>
    <v1:id type="PROVIDERID">1313</v1:id>
    <v1:id type="TIN">0</v1:id>
    </v1:ids>
    <v1:recordInfo>
    <v1:internalRecId>98151812</v1:internalRecId>
    </v1:recordInfo>
    <v1:createDate>2010-10-23T01:10:13</v1:createDate>
    <v1:updateDate>2010-10-23T01:10:13</v1:updateDate>
    </v1:physicianRelation>
    </v1:physicianRelations>
    <v1:maintainReasonCode>AC</v1:maintainReasonCode>
    <v1:recordInfo>
    <v1:internalRecId>82326286</v1:internalRecId>
    </v1:recordInfo>
    <v1:createDate>2010-05-09T14:23:17</v1:createDate>
    <v1:updateDate>2010-05-09T14:23:17</v1:updateDate>
    </v1:policy>
    <v1:policy effDate="2010-04-01" maintType="QUERY" type="SUBSCRIBER">
    <v1:ids>
    <v1:id type="POLICY">CPIT</v1:id>
    </v1:ids>
    <v1:hashCode>82326284</v1:hashCode>
    <v1:contractType>F</v1:contractType>
    <v1:maritalStatus>UNKNOWN</v1:maritalStatus>
    <v1:offerings>
    <v1:offering effDate="2010-04-01" maintType="QUERY" offeredBy="abc" offeringIdType="INSURANCE_TYPE" selected="Y">
    <v1:offeringId>IV</v1:offeringId>
    <v1:recordInfo>
    <v1:internalRecId>82326285</v1:internalRecId>
    </v1:recordInfo>
    <v1:createDate>2010-05-09T14:23:17</v1:createDate>
    <v1:updateDate>2011-01-20T04:53:52</v1:updateDate>
    </v1:offering>
    </v1:offerings>
    <v1:customer>
    <v1:relation type="EMPLOYMENT">
    <v1:customer>
    <v1:id idType="ACCOUNTID">C11204</v1:id>
    <v1:id idType="DIVISION">0208290000</v1:id>
    <v1:customerName>BC Group</v1:customerName>
    </v1:customer>
    </v1:relation>
    </v1:customer>
    <v1:maintainReasonCode>AC</v1:maintainReasonCode>
    <v1:recordInfo>
    <v1:internalRecId>82326284</v1:internalRecId>
    </v1:recordInfo>
    <v1:createDate>2010-05-09T14:23:17</v1:createDate>
    <v1:updateDate>2011-01-20T04:53:52</v1:updateDate>
    </v1:policy>
    </v1:policies>
    <v1:recordInfo>
    <v1:internalRecId>8364745</v1:internalRecId>
    <v1:objectVersionNo>1</v1:objectVersionNo>
    </v1:recordInfo>
    <v1:restrictedMemberIndicator>N</v1:restrictedMemberIndicator>
    <v1:createDate>2010-05-09T14:23:17</v1:createDate>
    <v1:updateDate>2010-08-08T02:40:24</v1:updateDate>
    </memberDetails>
    </getMemberResponse>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>

    Hi A_Non,
    Thanks so much for giving me the hint about that "text()" in XPath.
    I have new question for you with same XML I'm parsing right now.
    I have extracted a part(Policies) of whole XML and put it in one XMLTYPE variable. Below is that part XML.
    My question is I need to look only into that policy which is active right now. In the <policy> tag there are two attributes "effDate" and "endDate". "effDate" tag will always be there for every policy and for all inactive policies also "endDate" will be there always. Problem is with the active ones, "endDate" may or may not be there. If "endDate" is there so it will be greater than or equal to sysdate and if it is not there that means it is open ended. I need to fetch only that policy which is active right now and if there is no tag as such that means member is not active as of today.
    If "endDate" attribute is there then I think below XPath will work, but I'm not sure about how to handle when "endDate" attribute is not there.
    /d:policies/d:policy[@type="MEMBER" and number(translate(@effDate,"-",""))<=number(translate("'||l_currDate||'","-","")) and number(translate(@endDate,"-",""))>=number(translate("'||l_currDate||'","-",""))]I have Oracle 10.1.0.4, in this in XPath comparison operators are not working so I'm using XPath functions.
    Here is the XML
    <v1:policies>
       <v1:policy effDate="1999-05-01" endDate="1999-12-31" maintType="ADD" type="MEMBER">
           <v1:ids>
               <v1:id type="MEMBERID">SDF000414600</v1:id>
               <v1:id type="POLICY">SDF0004146</v1:id>
           </v1:ids>
           <v1:contractType>F</v1:contractType>
           <v1:dependentType>01</v1:dependentType>
           <v1:offerings>
               <v1:offering offeredBy="ABC" offeringIdType="INSURANCE_TYPE" selected="Y">
                   <v1:offeringId>IH</v1:offeringId>
               </v1:offering>
               <v1:offering effDate="1999-05-01" endDate="1999-12-31" maintType="ADD" offeredBy="ABC" offeringIdType="BOC" selected="Y">
                   <v1:offeringId>HA</v1:offeringId>
                   <v1:recordInfo>
                      <v1:internalRecId>39077481</v1:internalRecId>
                   </v1:recordInfo>
                   <v1:createDate>2010-05-01T01:27:04</v1:createDate>
                   <v1:updateDate>2010-05-01T01:27:04</v1:updateDate>
               </v1:offering>
           </v1:offerings>
           <v1:customer>
               <v1:relation type="EMPLOYMENT">
                   <v1:customer>
                      <v1:id idType="ACCOUNTID">AS35423</v1:id>
                      <v1:id idType="DIVISION">0621730000</v1:id>
                      <v1:customerName>Medical Associates</v1:customerName>
                   </v1:customer>
               </v1:relation>
           </v1:customer>
           <v1:physicianRelations>
               <v1:physicianRelation effDate="1999-05-01" endDate="1999-12-31" type="PCP">
                   <v1:ids>
                      <v1:id type="NPI">0</v1:id>
                      <v1:id type="AFFILIATIONID">66759       0014</v1:id>
                      <v1:id type="PROVIDERID">231231</v1:id>
                      <v1:id type="TIN">0</v1:id>
                   </v1:ids>
                   <v1:recordInfo>
                      <v1:internalRecId>87796651</v1:internalRecId>
                   </v1:recordInfo>
                   <v1:createDate>2010-10-22T21:56:44</v1:createDate>
                   <v1:updateDate>2010-10-22T21:56:44</v1:updateDate>
               </v1:physicianRelation>
           </v1:physicianRelations>
           <v1:maintainReasonCode>MD</v1:maintainReasonCode>
           <v1:recordInfo>
               <v1:internalRecId>39077480</v1:internalRecId>
           </v1:recordInfo>
           <v1:createDate>2010-05-01T01:27:04</v1:createDate>
           <v1:updateDate>2010-05-01T01:27:04</v1:updateDate>
       </v1:policy>
       <v1:policy effDate="2000-01-01" endDate="2000-12-31" maintType="ADD" type="MEMBER">
           <v1:ids>
               <v1:id type="MEMBERID">SDF000414600</v1:id>
               <v1:id type="POLICY">SDF0004146</v1:id>
           </v1:ids>
           <v1:contractType>F</v1:contractType>
           <v1:dependentType>01</v1:dependentType>
           <v1:offerings>
               <v1:offering offeredBy="ABC" offeringIdType="INSURANCE_TYPE" selected="Y">
                   <v1:offeringId>IH</v1:offeringId>
               </v1:offering>
               <v1:offering effDate="2000-01-01" endDate="2000-12-31" maintType="ADD" offeredBy="ABC" offeringIdType="BOC" selected="Y">
                   <v1:offeringId>HA</v1:offeringId>
                   <v1:recordInfo>
                      <v1:internalRecId>39077483</v1:internalRecId>
                   </v1:recordInfo>
                   <v1:createDate>2010-05-01T01:27:04</v1:createDate>
                   <v1:updateDate>2010-05-01T01:27:04</v1:updateDate>
               </v1:offering>
           </v1:offerings>
           <v1:customer>
               <v1:relation type="EMPLOYMENT">
                   <v1:customer>
                      <v1:id idType="ACCOUNTID">C35423</v1:id>
                      <v1:id idType="DIVISION">0621730000</v1:id>
                      <v1:customerName>Medical Associates</v1:customerName>
                   </v1:customer>
               </v1:relation>
           </v1:customer>
           <v1:physicianRelations>
               <v1:physicianRelation effDate="2000-01-01" endDate="2000-12-31" type="PCP">
                   <v1:ids>
                      <v1:id type="NPI">0</v1:id>
                      <v1:id type="AFFILIATIONID">66759       0014</v1:id>
                      <v1:id type="PROVIDERID">3213213</v1:id>
                      <v1:id type="TIN">0</v1:id>
                   </v1:ids>
                   <v1:recordInfo>
                      <v1:internalRecId>87796652</v1:internalRecId>
                   </v1:recordInfo>
                   <v1:createDate>2010-10-22T21:56:44</v1:createDate>
                   <v1:updateDate>2010-10-22T21:56:44</v1:updateDate>
               </v1:physicianRelation>
           </v1:physicianRelations>
           <v1:maintainReasonCode>MD</v1:maintainReasonCode>
           <v1:recordInfo>
               <v1:internalRecId>39077482</v1:internalRecId>
           </v1:recordInfo>
           <v1:createDate>2010-05-01T01:27:04</v1:createDate>
           <v1:updateDate>2010-05-01T01:27:04</v1:updateDate>
       </v1:policy>
       <v1:policy effDate="2001-01-01" maintType="ADD" type="MEMBER">
           <v1:ids>
               <v1:id type="MEMBERID">SDF000414600</v1:id>
               <v1:id type="POLICY">SDF0004146</v1:id>
           </v1:ids>
           <v1:contractType>F</v1:contractType>
           <v1:dependentType>01</v1:dependentType>
           <v1:offerings>
               <v1:offering offeredBy="ABC" offeringIdType="INSURANCE_TYPE" selected="Y">
                   <v1:offeringId>IH</v1:offeringId>
               </v1:offering>
               <v1:offering effDate="2001-01-01" endDate="2001-03-31" maintType="ADD" offeredBy="ABC" offeringIdType="BOC" selected="Y">
                   <v1:offeringId>HC</v1:offeringId>
                   <v1:recordInfo>
                      <v1:internalRecId>39077485</v1:internalRecId>
                   </v1:recordInfo>
                   <v1:createDate>2010-05-01T01:27:04</v1:createDate>
                   <v1:updateDate>2010-05-01T01:27:04</v1:updateDate>
               </v1:offering>
           </v1:offerings>
           <v1:customer>
               <v1:relation type="EMPLOYMENT">
                   <v1:customer>
                      <v1:id idType="ACCOUNTID">C35423</v1:id>
                      <v1:id idType="DIVISION">0621730000</v1:id>
                      <v1:customerName>Medical Associates</v1:customerName>
                   </v1:customer>
               </v1:relation>
           </v1:customer>
           <v1:physicianRelations>
               <v1:physicianRelation effDate="2001-01-01" endDate="2001-03-31" type="PCP">
                   <v1:ids>
                      <v1:id type="NPI">0</v1:id>
                      <v1:id type="AFFILIATIONID">66759       0014</v1:id>
                      <v1:id type="PROVIDERID">61232132</v1:id>
                      <v1:id type="TIN">0</v1:id>
                   </v1:ids>
                   <v1:recordInfo>
                      <v1:internalRecId>87796653</v1:internalRecId>
                   </v1:recordInfo>
                   <v1:createDate>2010-10-22T21:56:44</v1:createDate>
                   <v1:updateDate>2010-10-22T21:56:44</v1:updateDate>
               </v1:physicianRelation>
           </v1:physicianRelations>
           <v1:maintainReasonCode>LE</v1:maintainReasonCode>
           <v1:recordInfo>
               <v1:internalRecId>39077484</v1:internalRecId>
           </v1:recordInfo>
           <v1:createDate>2010-05-01T01:27:04</v1:createDate>
           <v1:updateDate>2010-05-01T01:27:04</v1:updateDate>
       </v1:policy>
    </v1:policies>Thanks

  • SQL: Need help putting single quote around string

    I want to put single quotes around string in my output.
    I am running the following command as a test:
    select ' ' hello ' ' from dual;
    My expectation is to get 'hello' (Single quote around hello)
    However I am getting the following error:
    ERROR at line 1:
    ORA-00923: FROM keyword not found where expected
    When I do SHOW ALL at my SQL command prompt, the escape is set as follows:
    escape "\" (hex 5c)
    I even tried: select '\'hello\'' from dual;
    I get back: select ''hello'' from dual
    ERROR at line 1:
    ORA-00923: FROM keyword not found where expected

    Hi,
    user521525 wrote:
    I want to put single quotes around string in my output.
    I am running the following command as a test:
    select ' ' hello ' ' from dual;
    My expectation is to get 'hello' (Single quote around hello)You probably read that you can get a single-quote within a string literal by using two of them in a row.
    That's true, but they really have to be in a row (no spaces in between), and you still need the single-quotes at the beiginning and end of the literal.
    So what you want is
    SELECT  '''hello'''
    FROM    dual;Starting in Oracle 10, you can also use Q-notation, For example:
    SELECT  Q'['hello']'
    FROM    dual;

  • Merge Two SQL - need help

    Hi All,
    Need some tips - like i have two different process runing with just only a SQL query on each.
    The both the process SQL Query is 90% similar Rather the Second sql has extra two columns
    and few filterning conditions is different which is Marked in bold. My question is there any way that
    i can write a single SQL statement that works for my both process. The Difference between the
    Query 1 and Query 2 have marked in Bold/underlined.
    Query 1
    SELECT SUBCON.MEME_CK,MEMBER_ID,LINE_NUMBER,RECIPIENT_NUMBER,MEMBER_LAST_NAME,MEMBER_FIRST_NAME,MEMBER_MIDDLE_INIT,MEMBER_SSN,MEMBER_DOB,
           MEMBER_ADDRESS_1,MEMBER_ADDRESS_2,MEMBER_CITY,MEMBER_STATE,MEMBER_ZIP_CODE,MEMBER_COUNTY_CODE,MEMBER_SEX,MEMBER_PHONE_NUMBER,
           HH_LAST_NAME,HH_FIRST_NAME,RELATIONSHIP_CODE,PCP_ID_NUMBER,PCP_NAME,PCP_PHONE_NUMBER,PCP_ADDRESS_1,PCP_ADDRESS_2,PCP_CITY,
           PCP_STATE,PCP_ZIP_CODE,PCP_COUNTY_CODE,PCP_EFFECTIVE_DATE,PCD_ID_NUMBER,PCD_NAME,PCD_PHONE_NUMBER,PCD_ADDRESS_1,
           PCD_ADDRESS_2,PCD_CITY,PCD_STATE,PCD_ZIP_CODE,PCD_COUNTY_CODE,PCD_EFFECTIVE_DATE,GROUP_EFF_DATE,GROUP_TERM_DATE,
           GROUP_NUMBER,PROGRAM_STATUS_CODE,LANGUAGE_INDICATOR,VISION_IMP_IND,HEARING_IMP_IND,SPECIAL_NEEDS_FLAG,ELIG_EFF_DATE,
           ELIG_TERM_DATE,BEN_GROUP_NO,BEN_GROUP_EFF_DT,MEDICARE_IND,TPL_RX_PAYER,TPL_RX_PAYER_EFF_DT,TPL_RX_PAYER_NAME,INSURANCE_CODE,
           POLICY_NUMBER,TYPE_OF_COVERAGE,LOB,COUNTY_STATE_RECORD,STATE_RECORD_NUMBER,GROUP_CODE,REV_CATEGORY_CODE,AQ_IND,MECD_CSCS_ID,
           MECB_EFF_DT,MCRE_ID,MECB_TERM_DT,rtrim(SBAD_PHONE) as "SBAD_PHONE"
    FROM      EXT_MEGD_SBCN_ELG_DLY SUBCON,
              CMC_MECD_MEDICAID MECD,
              CMC_SBAD_ADDR SBAD,
              CMC_MEME_MEMBER MEME
    WHERE     SUBCON.MEME_CK = MECD.MEME_CK
    AND        DATEDIFF(mm,MEMBER_DOB, DATEADD(mm,  1,GETDATE())) < 25_
    AND        Right(MECD_MCTR_AIDC,2) not in ('31', '33')
    AND        MECD_MCTR_AIDC Not in ('PC36','J36')
    AND        SUBCON.MEME_CK = MEME.MEME_CK
    AND        MEME.SBSB_CK *= SBAD.SBSB_CK
    AND        SBAD.SBAD_TYPE = "1"
    AND        SBAD.SBAD_PHONE <> " "
    AND        SBAD.SBAD_PHONE <> "0000000000"
    AND        CHAR_LENGTH(RTRIM(SBAD_PHONE)) < 11Query 2
    SELECT SUBCON.MEME_CK,MEMBER_ID,LINE_NUMBER,RECIPIENT_NUMBER,MEMBER_LAST_NAME,MEMBER_FIRST_NAME, MEMBER_MIDDLE_INIT,MEMBER_SSN,MEMBER_DOB,
           MEMBER_ADDRESS_1,MEMBER_ADDRESS_2,MEMBER_CITY,MEMBER_STATE,MEMBER_ZIP_CODE,MEMBER_COUNTY_CODE,MEMBER_SEX,MEMBER_PHONE_NUMBER,
           HH_LAST_NAME,HH_FIRST_NAME,RELATIONSHIP_CODE,PCP_ID_NUMBER,PCP_NAME,PCP_PHONE_NUMBER,PCP_ADDRESS_1,PCP_ADDRESS_2,PCP_CITY,
           PCP_STATE,PCP_ZIP_CODE,PCP_COUNTY_CODE,PCP_EFFECTIVE_DATE,PCD_ID_NUMBER,PCD_NAME,PCD_PHONE_NUMBER,PCD_ADDRESS_1,PCD_ADDRESS_2,
           PCD_CITY,PCD_STATE,PCD_ZIP_CODE,PCD_COUNTY_CODE,PCD_EFFECTIVE_DATE,GROUP_EFF_DATE,GROUP_TERM_DATE,GROUP_NUMBER,PROGRAM_STATUS_CODE,
           LANGUAGE_INDICATOR,VISION_IMP_IND,HEARING_IMP_IND,SPECIAL_NEEDS_FLAG,ELIG_EFF_DATE,ELIG_TERM_DATE,BEN_GROUP_NO,BEN_GROUP_EFF_DT,
           MEDICARE_IND,TPL_RX_PAYER,TPL_RX_PAYER_EFF_DT,TPL_RX_PAYER_NAME,INSURANCE_CODE,POLICY_NUMBER,TYPE_OF_COVERAGE,LOB,COUNTY_STATE_RECORD,
           STATE_RECORD_NUMBER,GROUP_CODE,REV_CATEGORY_CODE,AQ_IND,MECD_CSCS_ID,MECB_EFF_DT,MCRE_ID,MECB_TERM_DT,RTRIM(SBAD_PHONE) as "SBAD_PHONE",
           PRCF_MCTR_SPEC,PRAD_FAX
    FROM      EXT_MEGD_SBCN_ELG_DLY SUBCON,
              CMC_MECD_MEDICAID MECD,
              CMC_SBAD_ADDR SBAD,
              CMC_MEME_MEMBER MEME,
              CMC_PRPR_PROV    PRPR,_
              CMC_PRAD_ADDRESS PRAD_
    WHERE     SUBCON.MEME_CK = MECD.MEME_CK
    AND        Right(MECD_MCTR_AIDC,2) not in ('31', '33')
    AND        MECD_MCTR_AIDC Not in ('PC36','J36')
    AND        SUBCON.MEME_CK = MEME.MEME_CK
    AND        SUBCON.PCP_ID_NUMBER  = PRPR.PRPR_ID*_
    AND        SUBCON.PCP_ID_NUMBER  = PRAD.PRAD_ID*_
    AND        PRAD.PRAD_TYPE = 'PRI'_
    AND        (CONVERT(CHAR(10),GETDATE(),101))  BETWEEN PRAD.PRAD_EFF_DT AND PRAD.PRAD_TERM_DTAND        MEME.SBSB_CK *= SBAD.SBSB_CK_AND        SBAD_TYPE = "1"
    AND        SBAD_PHONE <> " "
    AND        SBAD_PHONE <> "0000000000"
    AND        CHAR_LENGTH(RTRIM(SBAD_PHONE)) < 11Any suggestions Welcome.
    Edited by: USER_X on May 18, 2009 11:03 AM

    Hi,
    The simplest thing, and perhaps the fastest, is to do a UNION, as Someoneelse suggested.
    See [this thread|http://forums.oracle.com/forums/message.jspa?messageID=3430965#3430965] for an example.
    Depending on your data, you could do an Outer Join of the two tables that are only in Query 2 to the other tables.
    The WHERE clause would look something like this:
    WHERE     SUBCON.MEME_CK = MECD.MEME_CK
    AND        Right(MECD_MCTR_AIDC,2) not in ('31', '33')
    AND        MECD_MCTR_AIDC Not in ('PC36','J36')
    AND        SUBCON.MEME_CK = MEME.MEME_CK
    AND        SBAD_PHONE  " "
    AND        SBAD_PHONE  "0000000000"
    AND        CHAR_LENGTH(RTRIM(SBAD_PHONE)) < 11
    AND        (     DATEDIFF (mm, MEMBER_DOB, DATEADD(mm,  1,GETDATE())) < 25     -- Extra condition from Query 1
            OR  (                                                                    -- Extra conditions from Query 2
                       SUBCON.PCP_ID_NUMBER   = PRPR.PRPR_ID
              AND   SUBCON.PCP_ID_NUMBER   = PRAD.PRAD_ID
              AND   PRAD.PRAD_TYPE          = 'PRI'_
              AND   (CONVERT(CHAR(10),GETDATE(),101))  BETWEEN PRAD.PRAD_EFF_DT
                                              AND      PRAD.PRAD_TERM_DT
              AND   MEME.SBSB_CK           = SBAD.SBSB_CK
              AND   SBAD_TYPE               = 1
            )Since all the tables in the Outer Join are referenced in the conditions from Query 2, this has the effect of making that an Inner Join unless the extra conditions from Query 1 were met.
    iIn the SELECT claue, use a CASE expression for each column that occurs only in Query 2 that repeats all the extra conditions for Query 2:
    ,       CASE
              WHEN  SUBCON.PCP_ID_NUMBER   = PRPR.PRPR_ID
              AND   SUBCON.PCP_ID_NUMBER   = PRAD.PRAD_ID
              AND   PRAD.PRAD_TYPE          = 'PRI'_
              AND   (CONVERT(CHAR(10),GETDATE(),101))  BETWEEN PRAD.PRAD_EFF_DT
                                              AND      PRAD.PRAD_TERM_DT
              AND   MEME.SBSB_CK           = SBAD.SBSB_CK
              AND   SBAD_TYPE               = 1
              THEN  PRCF_MCTR_SPEC
           END     AS PRCF_MCTR_SPECThat column will be NULL if the extra conditions from Query 2 are not met.
    Instead of computing all those extra conditions over and over again, you may want to compute them once for all in a sub-query:
    SELECT  ...
    ,       CASE
              WHEN  SUBCON.PCP_ID_NUMBER   = PRPR.PRPR_ID
              AND   SUBCON.PCP_ID_NUMBER   = PRAD.PRAD_ID
              AND   PRAD.PRAD_TYPE          = 'PRI'_
              AND   (CONVERT(CHAR(10),GETDATE(),101))  BETWEEN PRAD.PRAD_EFF_DT
                                              AND      PRAD.PRAD_TERM_DT
              AND   MEME.SBSB_CK           = SBAD.SBSB_CK
              AND   SBAD_TYPE               = 1
              THEN  1
                                    ELSE  0
           END     AS query_2_extraThen, in the main querry, you can use use that column:
    WHERE     ...
    AND        (     DATEDIFF (mm, MEMBER_DOB, DATEADD(mm,  1,GETDATE())) < 25     -- Extra condition from Query 1
            OR     query_2_extra = 1                                              -- Extra conditions from Query 2
            )

  • Beginning programmer: i need help its cake for some of you

    ok i have an assignment :
    hypothetically i have been given a data file that contains a letter(a,b,or c) and a number separated by a space it tellsme to create a program that will output the average each class of numbers (those w/ an 'a' on the same line, those w/ a 'b' etc etc.... this is all i have been able to get so far.... i'm trying to get this program to work so that it will print me all the numbers and letters on each line so that i know i can separate the info...... any help would be greatly appreciated
    import java.io.*;
    import java.util.StringTokenizer;
    import java.lang.String;
    public class HW2
         public static void main(String [] args)throws IOException
              BufferedReader br;
              br= new BufferedReader(new FileReader("filename"));
              String str= br.readLine();
              StringTokenizer st= new StringTokenizer(str);
              char c= st.nextToken.charAt(0);
              while (st.hasMoreTokens())
                   System.out.println(st.nextToken());
    }

    So you need to loop over each line in the file?
    You are almost there, the standard code is like this
    BufferedReader br = new BufferedReader(new FileReader("filename"));
    String str;
    // for each line in the file
    while ((str = br.readLine()) != null){
      // process the line
      System.out.println(str); 
    br.close();Replace the "process the line" comment with code that you do for each line.
    Good luck,
    evnafets

  • Concantenate SQL, need help

    I have a Table where columns 8, 9, 10, 11, and 12 need to be concatenated into a single column CUST_ADDRESS. I've already added the new column to the end of the Table.
    column 8 is: ADDRESS
    column 9 is: ADDRESS 2
    column 10 is: CITY
    column 11 is: STATE
    column 12 is: ZIP-CODE
    ADDRESS( )ADDRESS 2( )CITY(, )STATE( )ZIP
    I've done some research already and I think I found something that will work. The only problem is that I only need the 5 columns to be concatenated, there is 23 columns total in the Table. Also (this is not a big deal), but not sure if it would be possible to also use a ", " between the CITY and STATE and the rest can use a SPACE in the concatenation.
    Help would be appreciated, thanks!
    def Delimiter=" "
    SELECT
    ID,
    SUBSTR(MAX(REPLACE(
    SYS_CONNECT_BY_PATH(STRVAL, '/')
    ,'/','&Delimiter')),2) Concatenated_String
    FROM (
    select A.*,
    row_number() OVER (Partition by ID order by ID) ROW#
    from TMP_TEST A)
    START WITH ROW#=1
    CONNECT BY PRIOR ID=ID AND PRIOR row# = row# -1
    GROUP BY ID;

    Hi,
    How about:
    UPDATE  table_x
    SET     cust_address =  address
            || ' ' ||    address_2
            || ' ' ||     city
            || ',' ||     state
            || ' ' ||     zip_code;this will append the delimiters, even if some of the columns are NULL. For example, if only zip_code is actually present, cust_address will be something like ' , 27607' (starting with 2 spaces, a comma, and then another space).
    If you don't like that, try the following variation, which will omit any delimiter if the item immediately after it is NULL:
    UPDATE  table_x
    SET     cust_address =  address
            || NVL2 (address_2,     ' ' || address_2,     NULL)
            || NVL2 (city,     ' ' || city,          NULL)
            || NVL2 (state,     ',' ||     state,          NULL)
            || NVL2 (zip_code),     ' ' ||     zip_code,     NULL);

  • Sql-need help very complex query

    Hi all,
    I have a big SELECT statement hen i run it,it gives ORA-22813 error.
    Ora-22813:- The Collection value from one of the inner sub queries has exceeded the system limits and hence this error.
    It would be really great if you all could please help me in re-writing the inner join SELECTS in any other way so that we can process large amout of data.
    SELECT * FROM (SELECT
    mcat.CATALOG_ITEM_ID,
    mcat.CATALOG_ITEM_NAME ,
    mcat.DESCRIPTION,
    mcat.CATALOG_ITEM_TYPE,
    mcat.DELIVERY_METHOD,
    XMLElement("TRAINING_PLAN",XMLAttributes( TP.TPLAN_ID as "id" ),
    XMLELEMENT("COMPLETE_QUANTITY", TP.COMPLETE_QUANTITY),
    XMLELEMENT("COMPLETE_UNIT", TP.COMPLETE_UNIT),
    XMLElement("TOTAL_CREDITS", TP.numberOfCredits ),
    XMLELEMENT("IS_CREDIT_BASED", TP.IS_CREDIT_BASED),
    XMLELEMENT("IS_FOR_CERT", TP.IS_FOR_CERT),
    XMLELEMENT("ACCREDIT_ORG_NAME", TP.ACCRED_ORG_NAME),
    XMLELEMENT("ACCREDIT_ORG_ID", TP.accredit_org_id ),
    XMLElement("OBJECTIVE_LIST", TP.OBJECTIVE_LIST )
    ).extract('/').getClobVal() AS PLAN_LIST
    FROM
    student_master_catalog mcat
    INNER JOIN
    (SELECT stu_tp.TPLAN_ID,
    stu_tp.COMPLETE_QUANTITY,
    stu_tp.COMPLETE_UNIT,
    stu_tp.TPLAN_XML_DATA.extract('//numberOfCredits/text()').getStringVal() as numberOfCredits,
    stu_tp.IS_CREDIT_BASED,
    stu_tp.IS_FOR_CERT,
    stu_oa.ACCRED_ORG_NAME,
    stu_tp.TPLAN_XML_DATA.extract('//accreditingOrg/text()').getStringVal() as accredit_org_id,
    objective_list.OBJECTIVE_LIST
    FROM
    student_training_catalog stu_tp
    LEFT OUTER JOIN
    stu_accrediting_org stu_oa on stu_tp.TPLAN_XML_DATA.extract('//accreditingOrg/text()').getStringVal() = stu_oa.ACCRED_ORG_ID
    INNER JOIN
    (SELECT *
    FROM
    (SELECT
    stu_tpo.TPLAN_ID AS OBJECTIVE_TPLAN_ID,
    XMLAgg(
    XMLElement("OBJECTIVE",
    XMLElement("OBJECTIVE_ID",stu_tpo.T_OBJECTIVE_ID ),
    XMLElement("OBJECTIVE_NAME",stu_to.T_OBJECTIVE_NAME ),
    XMLElement("OBJECTIVE_REQUIRED_CREDITS_OR_ACTIVITIES",stu_tpo.REQUIRED_CREDITS ),
    XMLElement("ITEM_ORDER", stu_tpo.ITEM_ORDER ),
    XMLElement("ACTIVITY_LIST", activity_list.ACTIVITY_LIST )
    ) as OBJECTIVE_LIST
    FROM
    stu_TP_OBJECTIVE stu_tpo
    INNER JOIN
    stu_TRAINING_OBJECTIVE stu_to ON stu_tpo.T_OBJECTIVE_ID = stu_to.T_OBJECTIVE_ID
    INNER JOIN
    (SELECT *
    FROM
    (SELECT stu_toa.T_OBJECTIVE_ID AS ACTIVITY_TOBJ_ID, XMLAgg(
    XMLElement("ACTIVITY",
    XMLElement("ACTIVITY_ID",stu_toa.ACTIVITY_ID ),
    XMLElement("CATALOG_ID",COALESCE(stu_c.CATALOG_ID, COALESCE( stu_e.CATALOG_ID, stu_t.CATALOG_ID ) ) ),
    XMLElement("CATALOG_ITEM_ID",COALESCE(stu_c.CATALOG_ITEM_ID, COALESCE( stu_e.CATALOG_ITEM_ID, stu_t.CATALOG_ITEM_ID ) ) ),
    XMLElement("DELIVERY_METHOD",COALESCE(stu_c.DELIVERY_METHOD, COALESCE( stu_e.DELIVERY_METHOD, stu_t.DELIVERY_METHOD ) ) ),
    XMLElement("ACTIVITY_NAME",COALESCE(stu_c.COURSE_NAME, COALESCE( stu_e.EVENT_NAME, stu_t.TEST_NAME ) ) ),
    XMLElement("ACTIVITY_TYPE",initcap( stu_toa.ACTIVITY_TYPE ) ),
    XMLElement("IS_REQUIRED",stu_toa.IS_REQUIRED ),
    XMLElement("IS_PREFERRED",stu_toa.IS_PREFERRED ),
    XMLElement("NUMBER_OF_CREDITS",stu_lac.CREDIT_HOURS),
    XMLElement("ITEM_ORDER", stu_toa.ITEM_ORDER )
    )) as ACTIVITY_LIST
    FROM stu_TRAIN_OBJ_ACTIVITY stu_toa
    LEFT OUTER JOIN
    SELECT distinct lac.LEARNING_ACTIVITY_ID, lac.CREDIT_HOURS
    FROM student_training_catalog tp
    INNER JOIN stu_TP_OBJECTIVE tpo on tp.TPLAN_ID = tpo.TPLAN_ID
    INNER JOIN stu_TRAIN_OBJ_ACTIVITY toa on tpo.T_OBJECTIVE_ID = toa.T_OBJECTIVE_ID
    INNER JOIN stu_LEARNINGACTIVITY_CREDITS lac on lac.LEARNING_ACTIVITY_ID = toa.ACTIVITY_ID and tp.TPLAN_XML_DATA.extract                  ('//accreditingOrg/text()').getStringVal() = lac.ACC_ORG_ID
    where tp.tplan_id ='************'*
    ) stu_lac ON stu_lac.LEARNING_ACTIVITY_ID = stu_toa.ACTIVITY_ID        ------>This Select returns correct no. of rows
    This below SELECT inside the LEFT OUTER JOIN is the Problem.it returns too much because 3 tables are joined directly without any value qualification.
    LEFT OUTER JOIN
    ( SELECT ch.COURSE_HISTORY_ID, stu_c.COURSE_NAME, mca.catalog_item_id, mca.catalog_id, mca.delivery_method
    FROM stu_COURSE stu_c
    LEFT OUTER JOIN stu_course_history ch on stu_c.course_id = ch.ch_course_id -
    If i can qualify here with ch.ch_course_id = stu_toa.ACTIVITY_ID   (stu_toa.ACTIVITY_ID from the above select with correct no.  of   rows )
    Here,i get erros because i cant access outside values inside a left outer join
    LEFT OUTER JOIN student_master_catalog mca on ch.course_history_id = mca.catalog_item_id
    ) stu_c ON stu_c.COURSE_HISTORY_ID = stu_toa.ACTIVITY_ID
    LEFT OUTER JOIN
    (SELECT stu_e.EVENT_ID, stu_e.EVENT_NAME, mca.catalog_item_id, mca.catalog_id, mca.delivery_method FROM stu_EVENTS stu_e LEFT OUTER JOIN student_master_catalog mca on stu_e.event_Id = mca.catalog_item_id ) stu_e ON stu_e.EVENT_ID = stu_toa.ACTIVITY_ID
    LEFT OUTER JOIN
    (SELECT stu_t.TEST_HISTORY_ID, stu_t.TEST_NAME, mca.catalog_item_id, mca.catalog_id, mca.delivery_method FROM stu_TEST_HISTORY stu_t LEFT OUTER JOIN student_master_catalog mca on stu_t.test_history_id = mca.catalog_item_id) stu_t ON stu_t.test_history_id = stu_toa.ACTIVITY_ID
    GROUP BY stu_toa.T_OBJECTIVE_ID) ) activity_list ON activity_list.ACTIVITY_TOBJ_ID = stu_tpo.T_OBJECTIVE_ID
    GROUP BY stu_tpo.TPLAN_ID) ) objective_list ON objective_list.OBJECTIVE_TPLAN_ID = stu_tp.TPLAN_ID
    )TP ON TP.TPLAN_ID = mcat.CATALOG_ITEM_ID
    WHERE
    mcat.CATALOG_ITEM_ID = '*****************' and mcat.CATALOG_ORG_ID = '********')
    Edited by: user10817659 on Jan 16, 2009 12:49 PM
    Edited by: user10817659 on Jan 16, 2009 12:51 PM
    Edited by: user10817659 on Jan 16, 2009 12:52 PM
    Edited by: user10817659 on Jan 16, 2009 12:54 PM

    SELECT distinct lac.LEARNING_ACTIVITY_ID, lac.CREDIT_HOURS
    FROM student_training_catalog tp
    INNER JOIN stu_TP_OBJECTIVE tpo on tp.TPLAN_ID = tpo.TPLAN_ID
    INNER JOIN stu_TRAIN_OBJ_ACTIVITY toa on tpo.T_OBJECTIVE_ID = toa.T_OBJECTIVE_ID
    INNER JOIN stu_LEARNINGACTIVITY_CREDITS lac on lac.LEARNING_ACTIVITY_ID = toa.ACTIVITY_ID and tp.TPLAN_XML_DATA.extract ('//accreditingOrg/text()').getStringVal() = lac.ACC_ORG_ID
    where tp.tplan_id ='************'*
    *) stu_lac ON stu_lac.LEARNING_ACTIVITY_ID = stu_toa.ACTIVITY_ID ------>This Select returns 117 records which is correct no. of rows*
    This below SELECT inside the LEFT OUTER JOIN is the Problem.it returns too much because 3 tables are joined directly without any value qualification.
    LEFT OUTER JOIN
    ( SELECT ch.COURSE_HISTORY_ID, stu_c.COURSE_NAME, mca.catalog_item_id, mca.catalog_id, mca.delivery_method
    FROM stu_COURSE stu_c
    LEFT OUTER JOIN stu_course_history ch on stu_c.course_id = ch.ch_course_id -
    If i can qualify here with ch.ch_course_id = stu_toa.ACTIVITY_ID (stu_toa.ACTIVITY_ID from the above select with correct no. of rows )
    Here,i get erros because i cant access outside values inside a left outer join
    LEFT OUTER JOIN student_master_catalog mca on ch.course_history_id = mca.catalog_item_id
    **Here this query gives me huge 22k*
    *) stu_c ON stu_c.COURSE_HISTORY_ID = stu_toa.ACTIVITY_ID--->This join queriess 117 records from top with 22k records found by the nested selected and fails processing.*
    then here above
    LEFT OUTER JOIN
    (SELECT stu_e.EVENT_ID, stu_e.EVENT_NAME, mca.catalog_item_id, mca.catalog_id, mca.delivery_method FROM stu_EVENTS stu_e LEFT OUTER JOIN student_master_catalog mca on stu_e.event_Id = mca.catalog_item_id ) stu_e ON stu_e.EVENT_ID = stu_toa.ACTIVITY_ID
    LEFT OUTER JOIN
    (SELECT stu_t.TEST_HISTORY_ID, stu_t.TEST_NAME, mca.catalog_item_id, mca.catalog_id, mca.delivery_method FROM stu_TEST_HISTORY stu_t LEFT OUTER JOIN student_master_catalog mca on stu_t.test_history_id = mca.catalog_item_id) stu_t ON stu_t.test_history_id = stu_toa.ACTIVITY_ID
    GROUP BY stu_toa.T_OBJECTIVE_ID) ) activity_list ON activity_list.ACTIVITY_TOBJ_ID = stu_tpo.T_OBJECTIVE_ID
    GROUP BY stu_tpo.TPLAN_ID) ) objective_list ON objective_list.OBJECTIVE_TPLAN_ID = stu_tp.TPLAN_ID
    )TP ON TP.TPLAN_ID = mcat.CATALOG_ITEM_ID
    WHERE
    mcat.CATALOG_ITEM_ID = '*****************' and mcat.CATALOG_ORG_ID = '********')
    We’re getting the following error:*
    ORA-22813: operand value exceeds system limits*
    Cause: Object or Collection value was too large.*
    The size of the value might have exceeded 30k in a SORT context, or the size might be too big for available memory.*

  • Easy t-SQL (need help)

    Hi Gurus,
    colm01 Colum02 colum03 colum04 colum05
    10001 America World 10 null
    10002 Virginia Europe 20 10
    10003 Florida Asia 30 10
    In this table, I want to have a new column (colum06), that gives me NULL for America and 10001 for Virginia and Florida
    Thanks in advance
    ebro

    In this table, I want to have a new column (colum06), that gives me NULL for America and 10001 for Virginia and Florida
    Please try this: 
    SELECT
    CASE
    WHEN Colum02 = N'America' THEN NULL
    WHEN Colum02 IN ( N'Virginia', N'Florida' ) THEN 10001
    END AS Colum06
    FROM [Your Table]
    Cheers,
    Saeid Hasani
    Database Consultant
    Please feel free to contact me at [email protected] as well as on Twitter and Facebook.
    [My Writings on TechNet Wiki] [T-SQL Blog] [Curah!]
    [Twitter] [Facebook] [Email]

  • Rank SQL need help

    I have a simple Table with 2 columns, customer_id (distinct) and Spend
    some same fake data
    CUST_ID     SPEND        RANK
    1234          -125           0
    1254          -12             0
    1547          0               0
    5478          0               0
    8874          1               1
    6587          1               2
    65555        124            3
    54784        124            4
    45777        1148          5
    45774        2458          6I need to create a Rank column but only create the Rank for positive transaction, negative and 0 will get a RANK of 0, the rest need to have a rank where low spend gets low rank, and high spend gets high rank. Also if a customer has the same spend just rank them in the Order of the row position, ties can't have the same rank number, what is the best way to do this ?
    was thinking of ising row_number () over, but not sure how to make the RANK of 0 happen.
    I am on 11G, thank you!

    Hi,
    Kodiak_Seattle wrote:
    I have a simple Table with 2 columns, customer_id (distinct) and Spend
    some same fake data
    CUST_ID     SPEND        RANK
    1234          -125           0
    1254          -12             0
    1547          0               0
    5478          0               0
    8874          1               1
    6587          1               2
    65555        124            3
    54784        124            4
    45777        1148          5
    45774        2458          6I need to create a Rank column but only create the Rank for positive transaction, negative and 0 will get a RANK of 0, the rest need to have a rank where low spend gets low rank, and high spend gets high rank. Also if a customer has the same spend just rank them in the Order of the row position, ties can't have the same rank number, What is "row position"?
    The query below will assign unique numbers to ties, but there's no telling which of the tying rows will get the lower number. You can add more expressions to the analytic ORDER BY clause if you want to number the ties in a particular way.
    what is the best way to do this ?
    was thinking of ising row_number () over, Exactly! ROW_NUMBER will assign distinct numbers. RANK or DENSE_RANK would give duplicate results in case of a tie.
    but not sure how to make the RANK of 0 happen.
    I am on 11G, thank you!One way is to use CASE to assign 0 to the non-positive spends, and also to sort negatives at the end when computing the ROW_NUMBERSELECT       cust_id
    ,       spend
    ,       CASE
               WHEN  spend <= 0
               THEN  0
               ELSE  ROW_NUMBER () OVER ( ORDER BY CASE
                                       WHEN spend > 0
                                       THEN spend
                                                                   END
           END          AS rnk
    FROM       fake_data
    ORDER BY  spend
    ;Edited by: Frank Kulash on Jul 20, 2011 3:53 PM
    Here's a slightly more elegant way, that avoids a nested CASE expression:
    SELECT       cust_id
    ,       spend
    ,       CASE
               WHEN  spend <= 0
               THEN  0
               ELSE  ROW_NUMBER () OVER ( PARTITION BY  SIGN (spend)
                                                      ORDER BY      spend
                              ,                 cust_id     DESC     -- or whatever
                                                                   END
           END          AS rnk
    FROM       fake_data
    ORDER BY  spend
    ;I also added an example of numbering ties in a particular order.
    Edited by: Frank Kulash on Jul 20, 2011 4:05 PM

  • Need HELP with JetDirect 500x - I'm New to this Apple Thing!

    Hello. I am very new to Apple. I have been using PC's for years and I am over them. I am slowly trying to understand the differences and where to begin. I need help getting my printers setup with a JetDirect Box. Here is what I have.
    HP JetDirect 500x, with a dedicated IP address of 192.168.10.2, which is DHCP assigned by my wireless router. Connected to Port1 is a HP OfficeJet R40; Connected to port 2 is a HP Deskjet 9800.
    It appears that the drivers for both printers are built into OS 10.6.3.
    How do I set these bad boys up? I found one article where someone was doing something similar to me but I tried what he did and had no success.
    Here is what I tired in the Add Printer Dialog box:
    Protocol: HP JetDirect - Socket
    Address: 192.168.10.2:1 -or- http://192.168.10.2/ipp/port1
    I also tried Port 2. No luck.
    Please help. I am trying hard to get there. Thanks

    Welcome!
    The HP web site shows Mac drivers for up to 10.6 for the 9800 but no Mac drivers at all for the Deskjet 500. Only Windoze and Linux drivers listed for that one.
    I hope someone can jump is with a comment on the Mac compatibility of the JetDirect print server. We tried for years to get one to connect multiple printers at work and eventually threw in the towel. Maybe the newer ones are better, but I noticed the HP site recommends using USB printer sharing if it is necessary to network a 9800 on Macs. Could be a clue. You might need to contact HP support to find out if the JetDirect is Snow Leopard compatible.
    The last two printers we bought for our home network--a Brother 5250N b/w laser and an HP PhotoSmart C6280--were bought because they came with ethernet ports. They were a cinch to set up on the wired network and service six Macs, two via the wireless router and four on the wire.
    regards from the next state over,
    Allan

  • I'm new to SQL Server Integration Services and I need help on how to begin learning SSIS. Is there any training for it besides msdn?

    I'm new to SQL Server Integration Services and I need help on how to begin learning SSIS. Is there any training for it besides msdn?

    Check this thread where people have already given their suggestion on learning SSIS
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/f2cc1cf3-204d-454a-a189-47df87a3aa23/i-want-to-learn-ssis?forum=sqlintegrationservices
    I would suggest to go for You tube videos (type learn SSIS or begin SSIS step by step) you will get lot of good tutorials to start with.
    Happy Learning!!
    If this post answers your query, please click "Mark As Answer" or "Vote as Helpful".

  • Need help to redesign legacy SQL Script

    Hello Experts,
    I have the below code which produces a CREATE TRIGGER statement. as of now this does for updating. I need to re-design this code to add for inserting and deleting as well. I just need help in the structuring wise. I can build the logic for inserting and updating inside. I want to know how i can continue to get for "inserting" and "deleting" as well.
    you will understand my question better if you go through main code, present output and required output format below.
    I know this is a bad design first of all. but the below code is a legacy one. so i cant change the entire structure of the code :-( all i can do is to continue designing it to add new changes. Hence sought help from you all.
    please help
    SQL CODE:
    WITH audit_tables
    AS
       (SELECT object_name,
               MIN (column_id) min_col,
               MAX (column_id) max_col
        FROM   user_objects o,
               user_tab_columns c
        WHERE  o.object_name = 'CHR_VAL_DESC_A_T'
        AND    o.object_name = c.table_name
        GROUP BY object_name
    SELECT txt
    FROM (
    SELECT ' CREATE OR REPLACE TRIGGER ' || REPLACE(object_name,'_A_T') || '_ADT_TRG' || CHR(13) ||
           '   AFTER INSERT ' || CHR(13) ||
           '   OR    UPDATE ' || CHR(13) ||
           '   OR    DELETE ' || CHR(13) ||
           '   ON ' || REPLACE(object_name,'_A_T','_T') || CHR(13) ||
           '   FOR EACH ROW ' || CHR(13) ||
           ' DECLARE ' || CHR(13) ||
           ' BEGIN ' || CHR(13) ||
           ' IF updating THEN ' || CHR(13) ||
           '   INSERT INTO ' || object_name || CHR(13) ||
           '   (' txt, object_name, 1 disp_order, 0 column_id
    FROM audit_tables
    UNION ALL
    SELECT txt, object_name, disp_order, column_id
    FROM (SELECT 
            CASE
              WHEN max_col = column_id THEN
                '    '||column_name
              ELSE
                '    '||column_name || ','
              END AS txt, object_name, 2 disp_order, column_id
          FROM  audit_tables t,
                user_tab_columns C
          WHERE c.table_name = t.object_name
          ORDER BY c.column_id ASC)
    UNION ALL
    SELECT '   )' || CHR(13) ||
           '   VALUES ' || CHR(13) ||
           '   (', object_name, 3 disp_order, 0
    FROM audit_tables t
    UNION ALL
    SELECT txt, object_name, disp_order, column_id
    FROM (SELECT
            CASE
              WHEN max_col = column_id THEN
                CASE
                  WHEN SUBSTR(column_name,1,2) = 'N_' THEN
                    '    :NEW.'||decode(substr(column_name,1,2),'N_',substr(column_name,3))||');'
                  WHEN SUBSTR(column_name,1,2) = 'O_' THEN
                    '    :OLD.'||decode(substr(column_name,1,2),'O_',substr(column_name,3))||');'
                  WHEN min_col = column_id THEN
                    '    1'
                  WHEN column_id = 2 THEN
                    '     ''I'''
                  WHEN column_id = 3 THEN
                    '    SYSDATE'
                  ELSE
                  '    :NEW.'||column_name||');'
                END
              ELSE
                CASE
                  WHEN SUBSTR(column_name,1,2) = 'N_' THEN
                    '    :NEW.'||decode(substr(column_name,1,2),'N_',substr(column_name,3))||','
                  WHEN SUBSTR(column_name,1,2) = 'O_' THEN
                    '    :OLD.'||decode(substr(column_name,1,2),'O_',substr(column_name,3))||','
                  WHEN min_col = column_id THEN
                    '    1'||','
                  WHEN column_id = 2 THEN
                    '    ''I'''||','
                  WHEN column_id = 3 THEN
                    '    SYSDATE' ||','
                  ELSE
                    '    :NEW.'||column_name||','
                   END
              END AS txt,object_name, 4 disp_order, column_id
          FROM audit_tables t,
               user_tab_columns c
          WHERE c.table_name = t.object_name
          ORDER BY c.column_id ASC)
    UNION ALL
    SELECT 'END '||REPLACE(object_name,'_A_T') || '_ADT_TRG;' || CHR(13),
           object_name, 5 disp_order, 0
    FROM    audit_tables)
    ORDER BY object_name, disp_order, column_id
    PRESENT OUTPUT:
    CREATE OR REPLACE TRIGGER CHR_VAL_DESC_ADT_TRG
       AFTER INSERT
       OR    UPDATE
       OR    DELETE
       ON CHR_VAL_DESC_T
       FOR EACH ROW
    DECLARE
    BEGIN
    IF updating THEN
       INSERT INTO CHR_VAL_DESC_A_T
        TXN_ID,                                  
        TXN_TYP,                                 
        ADT_DTTM,                                
        CHR_VAL_DESC_ID,                         
        CHR_VAL_ID,                              
        LANG_ID,                                 
        DESC_ID,                                 
        O_CHR_VAL_DESC,                          
        N_CHR_VAL_DESC,                          
        O_TRANS_STATE,                           
        N_TRANS_STATE,                           
        CRTD_BY,                                 
        CRTD_DTTM,                               
        O_UPD_BY,                                
        N_UPD_BY,                                
        O_UPD_DTTM,                              
        N_UPD_DTTM,                              
        O_LOCK_NUM,                              
        N_LOCK_NUM                               
       VALUES
        1,                                       
        'I',                                     
        SYSDATE,                                 
        :NEW.CHR_VAL_DESC_ID,                    
        :NEW.CHR_VAL_ID,                         
        :NEW.LANG_ID,                            
        :NEW.DESC_ID,                            
        :OLD.CHR_VAL_DESC,                       
        :NEW.CHR_VAL_DESC,                       
        :OLD.TRANS_STATE,                        
        :NEW.TRANS_STATE,                        
        :NEW.CRTD_BY,                            
        :NEW.CRTD_DTTM,                          
        :OLD.UPD_BY,                             
        :NEW.UPD_BY,                             
        :OLD.UPD_DTTM,                           
        :NEW.UPD_DTTM,                           
        :OLD.LOCK_NUM,                           
        :NEW.LOCK_NUM);                          
    END CHR_VAL_DESC_ADT_TRG;
    REQUIRED OUTPUT FORMAT:
    CREATE OR REPLACE TRIGGER TRIGGER_NAME
       AFTER INSERT
       OR    UPDATE
       OR    DELETE
       ON TABLE_NAME
       FOR EACH ROW
    DECLARE
    BEGIN
    IF updating THEN
       INSERT TABLE_NAME
        list of column names                               
       VALUES
    IF inserting THEN
       INSERT TABLE_NAME
        list of column names                               
       VALUES
    IF deleting THEN
       INSERT TABLE_NAME
        list of column names                               
       VALUES
    END TRIGGER_NAME;

    can anyone please help?
    i tried adding with inserting and updating also..but when i tried to add deleting part the final output not comes in proper structure.
    WITH audit_tables
    AS
       (SELECT object_name,
               MIN (column_id) min_col,
               MAX (column_id) max_col
        FROM   user_objects o,
               user_tab_columns c
        WHERE  o.object_name IN ('CHR_VAL_DESC_A_T', 'CHR_VAL_A_T')
        AND    o.object_name = c.table_name
        GROUP BY object_name
    SELECT txt
    FROM (
    SELECT ' CREATE OR REPLACE TRIGGER ' || REPLACE(object_name,'_A_T') || '_ADT_TRG' || CHR(13) ||
           '   AFTER INSERT ' || CHR(13) ||
           '   OR    UPDATE ' || CHR(13) ||
           '   OR    DELETE ' || CHR(13) ||
           '   ON ' || REPLACE(object_name,'_A_T','_T') || CHR(13) ||
           '   FOR EACH ROW ' || CHR(13) ||
           ' DECLARE ' || CHR(13) ||
           ' BEGIN ' || CHR(13) ||
           *' IF inserting THEN '* || CHR(13) ||
           '   INSERT INTO ' || object_name || CHR(13) ||
           '   (' txt, object_name, 1 disp_order, 0 column_id
    FROM audit_tables
    UNION ALL
    SELECT txt, object_name, disp_order, column_id
    FROM (SELECT 
            CASE
              WHEN max_col = column_id THEN
                '    '||column_name
              ELSE
                '    '||column_name || ','
              END AS txt, object_name, 2 disp_order, column_id
          FROM  audit_tables t,
                user_tab_columns C
          WHERE c.table_name = t.object_name
          ORDER BY c.column_id ASC)
    UNION ALL
    SELECT '   )' || CHR(13) ||
           '   VALUES ' || CHR(13) ||
           '   (', object_name, 3 disp_order, 0
    FROM audit_tables t
    UNION ALL
    SELECT txt, object_name, disp_order, column_id
    FROM (SELECT
            CASE
              WHEN max_col = column_id THEN
                CASE
                  WHEN SUBSTR(column_name,1,2) = 'N_' THEN
                    '    :NEW.'||decode(substr(column_name,1,2),'N_',substr(column_name,3))||');'
                  WHEN SUBSTR(column_name,1,2) = 'O_' THEN
                    '    NULL'||');'
                  WHEN min_col = column_id THEN
                    '    1'
                  WHEN column_id = 2 THEN
                    '     ''I'''
                  WHEN column_id = 3 THEN
                    '    SYSDATE'
                  ELSE
                  '    :NEW.'||column_name||');'
                END
              ELSE
                CASE
                  WHEN SUBSTR(column_name,1,2) = 'N_' THEN
                    '    :NEW.'||decode(substr(column_name,1,2),'N_',substr(column_name,3))||','
                  WHEN SUBSTR(column_name,1,2) = 'O_' THEN
                    '    NULL'||','
                  WHEN min_col = column_id THEN
                    '    1'||','
                  WHEN column_id = 2 THEN
                    '    ''I'''||','
                  WHEN column_id = 3 THEN
                    '    SYSDATE' ||','
                  ELSE
                    '    :NEW.'||column_name||','
                   END
              END AS txt,object_name, 4 disp_order, column_id
          FROM audit_tables t,
               user_tab_columns c
          WHERE c.table_name = t.object_name
          ORDER BY c.column_id ASC)
    UNION ALL
    SELECT txt, object_name, disp_order, column_id
    FROM(SELECT *' ELSIF updating THEN '* || CHR(13) ||
           '   INSERT INTO ' || object_name || CHR(13) ||
           '   (' txt, object_name, 5 disp_order, 0 column_id
    FROM audit_tables
    UNION ALL
    SELECT txt, object_name, disp_order, column_id
    FROM (SELECT 
            CASE
              WHEN max_col = column_id THEN
                '    '||column_name
              ELSE
                '    '||column_name || ','
              END AS txt, object_name, 6 disp_order, column_id
          FROM  audit_tables t,
                user_tab_columns C
          WHERE c.table_name = t.object_name
          ORDER BY c.column_id ASC)
    UNION ALL
    SELECT '   )' || CHR(13) ||
           '   VALUES ' || CHR(13) ||
           '   (', object_name, 7 disp_order, 0
    FROM audit_tables t
    UNION ALL
    SELECT txt, object_name, disp_order, column_id
    FROM (SELECT
            CASE
             WHEN max_col = column_id THEN
                CASE
                  WHEN SUBSTR(column_name,1,2) = 'N_' THEN
                    '    :NEW.'||decode(substr(column_name,1,2),'N_',substr(column_name,3))||');'
                  WHEN SUBSTR(column_name,1,2) = 'O_' THEN
                    '    :OLD.'||decode(substr(column_name,1,2),'O_',substr(column_name,3))||');'
                  WHEN min_col = column_id THEN
                    '    1'
                  WHEN column_id = 2 THEN
                    '     ''U'''
                  WHEN column_id = 3 THEN
                    '    SYSDATE'
                  ELSE
                  '    :NEW.'||column_name||');'
                END
              ELSE
                CASE
                  WHEN SUBSTR(column_name,1,2) = 'N_' THEN
                    '    :NEW.'||decode(substr(column_name,1,2),'N_',substr(column_name,3))||','
                  WHEN SUBSTR(column_name,1,2) = 'O_' THEN
                    '    :OLD.'||decode(substr(column_name,1,2),'O_',substr(column_name,3))||','
                  WHEN min_col = column_id THEN
                    '    1'||','
                  WHEN column_id = 2 THEN
                    '    ''U'''||','
                  WHEN column_id = 3 THEN
                    '    SYSDATE' ||','
                  ELSE
                    '    :NEW.'||column_name||','
                END
              END AS txt,object_name, 8 disp_order, column_id
          FROM audit_tables t,
               user_tab_columns c
          WHERE c.table_name = t.object_name
          ORDER BY c.column_id ASC)
    UNION ALL
    SELECT 'END IF;' || CHR(13) ||
           'END '||REPLACE(object_name,'_A_T') || '_ADT_TRG;' || CHR(13),
           object_name, 9 disp_order, 0
    FROM    audit_tables)
    ORDER BY object_name, disp_order, column_id)

  • Need Help/Advice with Photo Web Gallery coming from SQL Database

    This is my first attempt at a database driven website. I assume what I am trying to accomplish should be fairly easy for more experienced but I am stuck at this point.
    First, let me explain what I am trying to accomplish.
    I want to create a thumbnail photo gallery displayed in columns and rows. I want to be able to hover over or click on the thumbnail image and have a lightbox script display the image over the thumb page. I am developing locally right now with intent to upload to the hosting site upon completion.
    I am developing with ASP vbScript pages. I have an SQL database where the paths to the image thumbnails and pictures are stored in a table. On the gallery page, I have created a div tag to hold my image recordset. Within this div, I have inserted 3 absolute positioned divs to hold the pictureID, the pictureName and the image inserted as a datasource. I then inserted the information from the bindings panel of my recordset. Last, I used a horizontal looper extension from Tom Muck to get the thumbnails to display in columns and rows. Everything works up to this point just fine.
    Now, I want to be able to hover or click on a thumnail image and have it displayed in a lightbox. I downloaded and used a javascript called Lightbox 2 which contains 3 javascript files and a css stylesheet. I inserted the files into the head tag like instructed to but could not get things to work properly. Here is where I need help. Currently, I am clicking on the thumbImage binding within the image Div and creating a link holder. I am then binding the larger pictureImage to it with the a.href selected in the bind to. I am then adding the command to call the lightbox javascript. Now, when I test my page, my thumbnail images do not show up (my alt text does in its place) but the links are in place and you can click on the alt text and it will return the correct larger image, but not in the lightbox, just in a new window with no styles.
    Am I going about this correctly? Can you use lightbox scripts with data-driven galleries? Does anybody have any suggestions of what I may be doing wrong or missing? Are there better ways to go about accomplishing this?
    Any help would be appreciated as this dynamic data thing has my head spinning. Although I know a database is needed to simplify the update and maintenance of the photos while allowing them to be searchable by keywords and tags also set up in the database.
    Thanks

    As I explained, I am developing locally a the moment. I will see about getting the databased moved up to the hosting server and then provide a link for an example.
    In the mean time, can you or anyone else explain a way that you would go about displaying an image thumbnail photo gallery laid out in rows / columns, with any lighbox script that would overlay the larger image over the existing page instead of opening a new browser window?
    I don't have to use the method I tried to describe.
    In all of the lightbox examples I have looked at thus far, they give instructions on how to append that javascript to a single static image or a group of static images, not images from a datasource. That is where I am getting confused.
    Don't know if this will help or not but please see code below:
    Javascript and CSS positioned in head tag
    <!--beginning of lightbox script with css -->
    <link href="CSS/lightbox.css" rel="stylesheet" type="text/css" />
    <script src="Scripts/protype.js" type="text/javascript"></script>
    <script src="Scripts/scriptaculous.js?load=effects,builder" type="text/javascript"></script>
    <script src="Scripts/lightbox.js" type="text/javascript"></script>
    <!--end of lightbox script with css -->
    Calling for javascript in the galleryimage div when hovering over thumbnail image
        <!--beginning of gallery div -->
        <div id="gallery">
          <p>
            <!--beginning of galleryImage div -->
          </p>
          <table width="400" border="0" align="center" id="galleryNav2">
            <tr>
              <td width="100" align="center"><% If MM_offset <> 0 Then %>
                  <a href="<%=MM_moveFirst%>">First</a>
              <% End If ' end MM_offset <> 0 %></td>
              <td width="100" align="center"><% If MM_offset <> 0 Then %>
                <a href="<%=MM_movePrev%>">Previous</a>
              <% End If ' end MM_offset <> 0 %></td>
              <td width="100" align="center"><% If Not MM_atTotal Then %>
                <a href="<%=MM_moveNext%>">Next</a>
              <% End If ' end Not MM_atTotal %></td>
              <td width="100" align="center"><% If Not MM_atTotal Then %>
                <a href="<%=MM_moveLast%>">Last</a>
              <% End If ' end Not MM_atTotal %></td>
            </tr>
          </table>
          <p> </p>
          <table align="center" id="HorzLooper">
            <%
    startrw = 0
    endrw = HLooper1__index
    numberColumns = 5
    numrows = 5
    while((numrows <> 0) AND (Not rs_ssfGallery.EOF))
    startrw = endrw + 1
    endrw = endrw + numberColumns
    %>
            <tr align="center" valign="top">
              <%
    While ((startrw <= endrw) AND (Not rs_ssfGallery.EOF))
    %>
              <td><div id="galleryImage">
                <div id="galleryThumb"><a href="images/pic/<%=(rs_ssfGallery.Fields.Item("picture_url").Value)%>"rel="lightbox"><img src="images/thumb/<%=(rs_ssfGallery.Fields.Item("thumb_url").Value)%>" alt="<%=(rs_ssfGallery.Fields.Item("alt_url").Value)%>" /></a></div>
                <div id="galleryImageID"><%=(rs_ssfGallery.Fields.Item("picture_ID").Value)%></div>
                <div id="galleryImageFamily"><%=(rs_ssfGallery.Fields.Item("family").Value)%></div>
              </div></td>
              <%
    startrw = startrw + 1
    rs_ssfGallery.MoveNext()
    Wend
    %>
            </tr>
            <%
    numrows=numrows-1
    Wend
    %>
          </table>
          <p> </p>
          <table width="400" border="0" align="center" id="galleryNav">
            <tr>
              <td width="100" align="center"><% If MM_offset <> 0 Then %>
                  <a href="<%=MM_moveFirst%>">First</a>
              <% End If ' end MM_offset <> 0 %></td>
              <td width="100" align="center"><% If MM_offset <> 0 Then %>
                  <a href="<%=MM_movePrev%>">Previous</a>
              <% End If ' end MM_offset <> 0 %></td>
              <td width="100" align="center"><% If Not MM_atTotal Then %>
                  <a href="<%=MM_moveNext%>">Next</a>
              <% End If ' end Not MM_atTotal %></td>
              <td width="100" align="center"><% If Not MM_atTotal Then %>
                  <a href="<%=MM_moveLast%>">Last</a>
              <% End If ' end Not MM_atTotal %></td>
            </tr>
          </table>
    <!--end of galleryImage div -->
        </div>
        <!--end of gallery div -->
    Thanks for any help or suggestions.

  • Need Help in Splitting a String Using SQL QUERY

    Hi,
    I need help in splitting a string using a SQL Query:
    String IS:
    AFTER PAINT.ACOUSTICAL.1..9'' MEMBRAIN'I would like to seperate this string into multiple lines using the delimeter .(dot)
    Sample Output should look like:
    SNO       STRING
    1            AFTER PAINT
    2            ACOUSTICAL
    3            1
    4            
    5            9" MEMBRAIN
    {code}
    FYI i am using Oracle 9.2                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    There's this as well:
    with x as ( --generating sample data:
               select 'AFTER PAINT.ACOUSTICAL.1..9" MEMBRAIN' str from dual union all
               select 'BEFORE PAINT.ELECTRIC.2..45 caliber MEMBRAIN' str from dual)
    select str,
           row_number() over (partition by str order by rownum) s_no,
           cast(dbms_xmlgen.convert(t.column_value.extract('//text()').getstringval(),1) as varchar2(100)) res
    from x,
         table(xmlsequence(xmltype('<x><x>' || replace(str,'.','</x><x>') || '</x></x>').extract('//x/*'))) t;
    STR                                                S_NO RES                                                                                                
    AFTER PAINT.ACOUSTICAL.1..9" MEMBRAIN                 1 AFTER PAINT                                                                                        
    AFTER PAINT.ACOUSTICAL.1..9" MEMBRAIN                 2 ACOUSTICAL                                                                                         
    AFTER PAINT.ACOUSTICAL.1..9" MEMBRAIN                 3 1                                                                                                  
    AFTER PAINT.ACOUSTICAL.1..9" MEMBRAIN                 4                                                                                                    
    AFTER PAINT.ACOUSTICAL.1..9" MEMBRAIN                 5 9" MEMBRAIN                                                                                        
    BEFORE PAINT.ELECTRIC.2..45 caliber MEMBRAIN          1 BEFORE PAINT                                                                                       
    BEFORE PAINT.ELECTRIC.2..45 caliber MEMBRAIN          2 ELECTRIC                                                                                           
    BEFORE PAINT.ELECTRIC.2..45 caliber MEMBRAIN          3 2                                                                                                  
    BEFORE PAINT.ELECTRIC.2..45 caliber MEMBRAIN          4                                                                                                    
    BEFORE PAINT.ELECTRIC.2..45 caliber MEMBRAIN          5 45 caliber MEMBRAIN      
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Maybe you are looking for

  • Adobe Media Encoder CS4 problem

    I having a ***** at Adobe I do have a lienced copoy  CS4 Design Premium. I down loaded premier  pro CS4 to demo it about 8 months ago and had not used it up to about 1 weeks ago. All that time Adobe Media Encoder CS4 did not work. I came back to the

  • Automatic Double Side Printing

    Here is HP LaserJet Enterprise 600 Series Printer manual check page 117 for settings with screenshots how to set up automatic both sides printing.

  • URGENT using java in Forms 9i

    Hi, I need to use one Java module in Forms 9i, i use the Import Class Java, no problems. But when i try to use this function, i can't recuperate the data in this object in Forms. In this program works the 2 first instruction, but the 3 work, but i do

  • How to find the Quicklink from INavigationNode

    Hi All, I am using the tagLibrary to build the Top Level and Detailed Level Navigation. We are trying to use the Quicklinks(Short URLs of SP14) as the URLs for all the links in Top Level and detailed navigation. However I am not able to get the Quick

  • Using send email step in workflow

    Hi Experts, I have a question regarding the send email step in workflow. We have the Receipient Type as Organizational Object and Expression as &WF_INITIATOR&. I want to know if the mail will be sent to the SAP email ID (i.e) in SBWP or will be it be