Decoding- best way to decode characters to numbers using a conversion table

I have input string which mostly contains numbers, but at the end there are 2 characters which means a country code, like 'EE' for estonia, or 'LV' for latvia and so on, see example input value:
select '9999123456789012EE00' input, null output from dual;I want into column Output to put value where those 2 characters are decoded/replaced with numbers with following algorithm:
1. replace in input string 9999123456789012EE00 characters with numbers 14 and 14 so the output would be 9999123456789012141400.
2. The 14 was for specially letter 'E', all alphabet is encoded like following:
A=10
B=11
C=12
D=13
E=14
Y=34
Z=35
So, value "9999123456789012LV00" should be converted into 9999123456789012213100 (L = 21, V =31).
What is the best way to achieve such decoding in plsql/sql?
Edited by: CharlesRoos on Mar 16, 2010 3:52 AM

Thx, Seems very nice.
with t as (
  select '9999123456789012LV00' input from dual 
  union all
  select '9999123456789012AA00' input from dual
  union all
  select '9AA99912345678901200' input from dual
select input,
       regexp_replace (input,  '[[:alpha:]]+',
                       (ascii (regexp_substr (input, '[[:alpha:]]')) - 55) || (ascii (regexp_substr (input, '[[:alpha:]]',1,2)) - 55))output
from t
9999123456789012LV00     9999123456789012213100
9999123456789012AA00     9999123456789012101000
9AA99912345678901200     9101099912345678901200
;

Similar Messages

  • Best way to get and pass filename from a DB Table to SQL Loader?

    What is the best way to get the data filename from an Oracle Table to pass it to SQL Loader?

    I am looking for a sompler way.
    I only want to instruct SQL Loader/Control file to get the filename from a table. Do we need external tables for this? Can I pass a funciton/SQL as parameter to filename?
    Thanks

  • I have a macbook pro I use for work and iMac at home. What is best way to manage my files? Use iCloud? Dock my laptop when I come home? Appreciate any suggesitons

    I have a macbook pro I use for work and iMac at home. What is best way to manage my files? Use iCloud? Dock my laptop when I come home? Appreciate any suggesitons

    That depends on what kind of "files" you're talking about and what your employer's policy is on using cloud storage.
    I found dropbox and/or OneDrive work very well for keeping documents in sync between multiple machines.

  • What is the best way to set up Facetime if using multiple computers with one apple ID?

    I currently have FaceTime setup on my iPad 2 using my normal appleID, but have just recently upgraded our iMac from Leopard to Snow leopard, and have added FaceTime to that computer as well. So my question is this. If I want to avoid confusion with which device is called when someone calls us using FaceTime, what is the best way to distinguish the devices? Should I try to use a different email address to reach the iMac? Is there a best-known-method for this?

    That's a nice system Kevin, and it will work very nicely with Photoshop.  I do take it that you have 16Gb RAM in Total?
    250Gb SSD is a good size, but you can still run short, and that will affect Windows performance.  When you get your system, instal WinDirStat which gives you a graphic display of everything on your drive, like below. Clicking on any of the large areas will tell you what and where they are, so you can think about moving cache folders etc. to one of the HDDs.
    Leave the Pagefile.sys on the boot drive.  Think about disabling Hyphenate as it takes a ton of space, and too often crashes on wake up.
    My Documents
    Desktop
    Downloads
    Look at Bridge cache
    iTunes backup
    Other stuff like that.
    Think about another 500Gb drive just for Photoshop Scratch.  Drives are cheap as chips nowadays
    Do yourself a favour, and invest $100 in Shadow Protect (or similar if there is such a thing) SP saves incremental backups every 15 minutes (you can set the interval, but it has no impact on performance with a system like yours).  If you have a problem you can mount the back up at any of those 15 minute points, and open files from it.  You can also make a bootable DVD image of your C drive, and be back up and running five minutes after disaster strikes.
    Optimize Performance in Photoshop
    Photoshop CC and CC 2014 GPU FAQ
    For more ideas, swing by the Premiere Pro Hardware forum.  Those guys are serious good at this stuff, and you'll find links tips and ideas.
    Happy computing, and have fun with your Creative Cloud® apps.

  • What is the best way to implement default values stored in a DB table?

    [JHeadstart 10.1.3 build 78]
    [JDeveloper 10.1.3 SU4]
    We are struggling on how to best implement default values that are stored in a DB table. What we have is a database table with (CODE_TYPE, TABLE_NAME, COLUMN_NAME, DEFAULT_VALUE) as columns. This way the application administrator can administer default values himself/herself. Now we need to find the best way to set these table supplied default values in new rows. Globally we are aware of two ways:
    - override create() method on VO
    - probably create a View Object on top of the database table with default values (we are capable of transposing the table and return exactly one row with a column for each default value) and use JHeadstarts item property 'Default Value'.
    We prefer the latter, since this is more declarative, however we struggle with the EL expression needed to indicate the default value.
    If we have a VO named "DefaultValues" with a SELECT on a view on top of our database table (transposed) returning exactly one row, let us say:
    SELECT orglanguage, orgtype, orgstatus [...]
    FROM v_default_values
    --> returning exactly one row
    and we want an EL expression on an item that needs the value from orglanguage. What will the EL expression be? Something like:
    #{data.DefaultValuesPageDef.currentrow.orglanguage.inputValue}? We tried several things but they do not work. A static default value works, but every EL expression so far does not. We know that using "data" can be dangerous, but thought JHeadstart takes care of preparing the other Page Definitions, so it might be possible when you use JHeadstart.
    Or is overriding the create() method the preferred way? Or do we have to look at a Managed Bean for our default values that we refer to from EL (let us say MyAppDefaultValuesBean) and in that case: how do you associate a Managed Bean with a VO?
    Any help would be appreciated. Apart from these default values, things are going rather well in this first J2EE/JHS project for us!
    Toine

    Steven,
    Thanks for the reply. Unfortunately whatever we try, we cannot get it to work. We started looking at the second option (since we do need default values also in table lay-out new rows). We created a DefaultValues ViewObject, added it to the Application Module, added an EL expressiona to the Default Display Value property (replacing your ending ")" with a "}" offcourse ;-)), ran the JAG so that a page definition was generated for DefaultValues and we managed to get it prepared when loading for example the Organisation's jspx page. However no default value appears in a new row (not in Form, not in Table layout).
    I then created a quick application on top of the HR schema, added a DefaultValues ViewObject using one calculated attribute (set Salary fixed to 1000), added the EL expression to the Salary Default Display Value property in the Employees Group, made sure the DefaultValuesPageDef is prepared by adding it to the parameter section and I see it getting prepared. I also see a managed Bean is created in the Employees-bean.xml.
    In the Embedded OC4J log we see:
    16:01:01 DEBUG (JhsPageLifecycle) -executing onCreate
    16:01:01 DEBUG (JhsPageLifecycle) -CreateEmployeesDefaultValues bean found, applying default values to new row
    2006-08-02 16:01:01.825 WARNING [ADFc] Warning: No Method onCreateEmployees and no actionBinding CreateEmployees found.
    Is it this warning we should be worried about? Since no default value is created.
    The managed bean (Employees-beans.xml) looks like:
    <?xml version="1.0" encoding="windows-1252"?>
    <!DOCTYPE faces-config PUBLIC
    "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
    "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
    <faces-config xmlns="http://java.sun.com/JSF/Configuration">
    <managed-bean>
    <managed-bean-name>CreateEmployeesDefaultValues</managed-bean-name>
    <managed-bean-class>oracle.jheadstart.controller.jsf.bean.DefaultValuesBean</managed-bean-class>
    <managed-bean-scope>request</managed-bean-scope>
    <managed-property>
    <property-name>iteratorBinding</property-name>
    <value>#{bindings.EmployeesIterator}</value>
    </managed-property>
    <managed-property>
    <property-name>defaultValues</property-name>
    <map-entries>
    <map-entry>
    <key>Salary</key>
    <value>#{data.DefaultValuesPageDef.DefaultValuesIterator.currentRow.Salary}</value>
    </map-entry>
    </map-entries>
    </managed-property>
    <managed-property>
    <property-name>actionResult</property-name>
    <value>CreateEmployees</value>
    </managed-property>
    </managed-bean>
    <managed-bean>
    <managed-bean-name>searchEmployees</managed-bean-name>
    <managed-bean-class>oracle.jheadstart.controller.jsf.bean.JhsSearchBean</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
    <managed-property>
    <property-name>bindings</property-name>
    <value>#{data.EmployeesPageDef}</value>
    </managed-property>
    <managed-property>
    <property-name>searchBinding</property-name>
    <value>#{data.EmployeesPageDef.advancedSearchEmployees}</value>
    </managed-property>
    <managed-property>
    <property-name>searchAttribute</property-name>
    <value>EmployeeId</value>
    </managed-property>
    <managed-property>
    <property-name>dataCollection</property-name>
    <value>EmployeesView1</value>
    </managed-property>
    <managed-property>
    <property-name>autoquery</property-name>
    <value>true</value>
    </managed-property>
    </managed-bean>
    <managed-bean>
    <managed-bean-name>EmployeesCollectionModel</managed-bean-name>
    <managed-bean-class>oracle.jheadstart.controller.jsf.bean.JhsCollectionModel</managed-bean-class>
    <managed-bean-scope>request</managed-bean-scope>
    <managed-property>
    <property-name>jhsPageLifecycle</property-name>
    <value>#{jhsPageLifecycle}</value>
    </managed-property>
    <managed-property>
    <property-name>bindings</property-name>
    <value>#{bindings}</value>
    </managed-property>
    <managed-property>
    <property-name>rangeBinding</property-name>
    <value>#{bindings.EmployeesTable}</value>
    </managed-property>
    <managed-property>
    <property-name>defaultValues</property-name>
    <value>#{CreateEmployeesDefaultValues.defaultValues}</value>
    </managed-property>
    </managed-bean>
    </faces-config>
    This is the DefaultValues.xml:
    <?xml version='1.0' encoding='windows-1252' ?>
    <!DOCTYPE ViewObject SYSTEM "jbo_03_01.dtd">
    <ViewObject
    Name="DefaultValues"
    BindingStyle="OracleName"
    CustomQuery="true"
    ComponentClass="hr.model.DefaultValuesImpl"
    UseGlueCode="false" >
    <DesignTime>
    <Attr Name="_version" Value="10.1.3.36.73" />
    <Attr Name="_codeGenFlag2" Value="Access|Coll|VarAccess" />
    </DesignTime>
    <ViewAttribute
    Name="Salary"
    IsUpdateable="false"
    IsPersistent="false"
    Precision="255"
    Type="java.lang.String"
    ColumnType="VARCHAR2"
    AliasName="SALARY"
    Expression="1000"
    SQLType="VARCHAR" >
    </ViewAttribute>
    </ViewObject>
    The PageDef for Defaultvalues is like:
    <?xml version="1.0" encoding="UTF-8" ?>
    <pageDefinition xmlns="http://xmlns.oracle.com/adfm/uimodel"
    version="10.1.3.36.73" id="DefaultValuesPageDef"
    Package="hr.view.pagedefs" EnableTokenValidation="false">
    <parameters/>
    <executables>
    <iterator id="DefaultValuesIterator"
    Binds="AppModuleDataControl.DefaultValues1"
    DataControl="AppModuleDataControl" RangeSize="10"/>
    </executables>
    <bindings>
    <attributeValues id="DefaultValuesSalary"
    IterBinding="DefaultValuesIterator">
    <AttrNames>
    <Item Value="Salary"/>
    </AttrNames>
    </attributeValues>
    <table id="DefaultValuesTable" IterBinding="DefaultValuesIterator">
    <AttrNames>
    <Item Value="Salary"/>
    </AttrNames>
    </table>
    <action id="FirstDefaultValues" IterBinding="DefaultValuesIterator"
    DataControl="AppModuleDataControl" RequiresUpdateModel="true"
    Action="12"/>
    <action id="PreviousDefaultValues" IterBinding="DefaultValuesIterator"
    DataControl="AppModuleDataControl" RequiresUpdateModel="true"
    Action="11"/>
    <action id="NextDefaultValues" IterBinding="DefaultValuesIterator"
    DataControl="AppModuleDataControl" RequiresUpdateModel="true"
    Action="10"/>
    <action id="LastDefaultValues" IterBinding="DefaultValuesIterator"
    DataControl="AppModuleDataControl" RequiresUpdateModel="true"
    Action="13"/>
    <methodAction RequiresUpdateModel="true" Action="999"
    id="advancedSearchDefaultValues"
    IterBinding="DefaultValuesIterator"
    DataControl="AppModuleDataControl"
    InstanceName="AppModuleDataControl.dataProvider"
    MethodName="advancedSearch"
    ReturnName="AppModuleDataControl.methodResults.AppModuleDataControl_dataProvider_advancedSearch_result"
    IsViewObjectMethod="false">
    <NamedData NDName="viewObjectUsage"
    NDValue="#{searchDefaultValues.dataCollection}"
    NDType="java.lang.String"/>
    <NamedData NDName="arguments" NDValue="#{searchDefaultValues.arguments}"
    NDType="java.util.ArrayList"/>
    <NamedData NDName="allConditionsMet"
    NDValue="#{searchDefaultValues.allConditionsMet}"
    NDType="java.lang.Boolean"/>
    </methodAction>
    <action id="setCurrentRowWithKeyDefaultValues"
    IterBinding="DefaultValuesIterator"
    InstanceName="AppModuleDataControl.DefaultValues1"
    DataControl="AppModuleDataControl" RequiresUpdateModel="false"
    Action="96">
    <NamedData NDName="rowKeyStr" NDValue="#{row.rowKeyStr}"
    NDType="java.lang.String"/>
    </action>
    <action id="CreateDefaultValues" IterBinding="DefaultValuesIterator"
    DataControl="AppModuleDataControl" RequiresUpdateModel="true"
    Action="40"/>
    <action id="DeleteDefaultValues" IterBinding="DefaultValuesIterator"
    DataControl="AppModuleDataControl" RequiresUpdateModel="false"
    Action="30"/>
    <action id="Commit" RequiresUpdateModel="true" Action="100"
    DataControl="AppModuleDataControl"/>
    <action id="Rollback" RequiresUpdateModel="false" Action="101"
    DataControl="AppModuleDataControl"/>
    </bindings>
    </pageDefinition>
    We do not understand what is wrong and why the default values do not get created in the new rows (and it is taking us far too much time). Any chance the EL expression is still wrong? It is a shame that any syntax errors in EL expressions are not visible in some logfile. It looks like when EL expressions are wrong, they are ignored instead of raising an error...
    Toine

  • Best ways to view data, total records of an application table ie VBAK

    Hi all,
    What is the best way to view data of an application table in the source system?
    I know about SE16....but are there other ways to know details ie the total no of records and different field information about a
    application table ie VBAK in source R3?
    Also, using SE16 when i checked for VBAK and clicked on the "number of enteries" then it showed 0...however
    when i directly checked from the sqlplus then i found about 5000 records in there in VBAK. I am not sure why
    via SE16 it showed 0. Does anybody have any idea what i missed here?
    Thanks...will give points for ur input.
    ak

    I tried "number of enteried" on se16 and it shows 0 enteries without any selection criterion...i cheked by putting relevant time range as well but it shows 0...
    As i told that when i checked VBAK separately via logging to database directly then i did find 5678 rows there.
    Please note that this is a new demo version....so i thought that i first need to activate the table which i did using tcode SE11. Now the VBAK table is active but still via SE16 shows 0 nuber of enteris....
    Can anybody please advise here..
    Thx
    ak

  • Best Way to Override 'Everyone - Read Only' using ACLs

    Hi, let me first clarify that I'm not an 'official' network administrator, I'm just the only one in a small design office able to attempt to figure this stuff out.
    We are needing to upgrade our security in a small office (5-7 users, 1 server running OSX Server 10.4.4).
    We've been working great since OSX Server 10.3.x using standard POSIX privileges setup as follows:
    Owner: Our_Server - R/W
    Group: OurGroup - R/W
    Everyone: None
    We've been able to share files great as we're all in the same group (OurGroup). No problems.
    Unfortunately, we now need to add a higher level of security for some incoming freelance workers. Essentially, we need to give them access to only certain folders UNDER our main Share Point directory. But we need to retain all of the freedom we've always had for the entire Shared directory.
    From my understanding, the only way to do this is by using ACL's and a different group for the freelancers. I've setup a TEST directory to try this on. I've almost got it setup to work the way we want, but now am experiencing what I've discovered to be one of the drawbacks of using ACL's - the "Inherit Permissions from Parent" feature of AFP is no longer an option.
    So using this method, new files added by default pick up the standard POSIX permissions, which allow Read access to Everyone. And I have to 'replicate' the behavior of 'Owner' and 'Group' that we had working before using POSIX or the group would end up Read Only.
    - Any way to simulate the inherited permission of 'Everyone: None" using ACLs?
    - Is there an easier/better way to allow access to only certain sub-folders of our main Share Point for a different group (FreelanceGroup)?
    - Any way to do this while keeping our good working POSIX model?
    - What should my POSIX access settings be set now when using ACLs?
    - How dangerous is having 'Everyone: Read Access' really? We have guest access disabled, appropriate firewalls, etc.?
    Thanks a lot. I hope I'm approaching this properly. I'm open to any tips. We just need to make sure nothing 'appears' to change too much in the workflow we have grown accustomed to (within reason).
    G5 Dual 2Ghz   Mac OS X (10.4)   1.5GB RAM

    If you haven't already, you may find my ACL Tips post helpful: http://discussions.apple.com/thread.jspa?messageID=1696702
    My best advice would be to concentrate on defining ACLs for the groups of users for whom access should be granted (Allow rules). These can define inheritance for newly created files and folders, and you don't have the limit of having to think about just one group and everyone else. Remember that the POSIX "everyone" group is actually "everyone else" - that is, any valid user (guest if guest access is enabled) who does NOT match the owner or who is NOT a member of the POSIX group. The way that POSIX permissions are calculated, the connecting user is always granted ownership if possible, then group membership (primary group first, membership lookup by GID second) if that fails. Failing the two, the everyone else permissions are returned.
    Here's an example that highlights the difference:
    There is a group called "everyone" - that's actually all users, guests included, if guest access is enabled. This group is NOT the POSIX everyone else field. Rather, if you grant an ACL deny for everyone, then that covers all users, not just those for whom you don't have an ACL defined!
    Further, there's an "authed users" group, which is the group of all authenticated users (and it never includes guests, even if guest access is enabled). Like the "everyone" group, membership is calculated by GUID by memberd. So you can thinnk of these two groups as "smart groups."
    Since the "smart groups" have membership controlled by memberd and GUID values, it's wise to only use them when defining ACL entries. Neither should be used for the group value of the POSIX group field. Either membership calculation will fail, or the "everyone else" POSIX field may never need to be consulted.
    As to the missing "inherit from parent" feature, the story is just the opposite: ACLs actually give you better inheritance than that feature ever did. For example, ACLs each support inheritance with the file_inherit, directory_inherit, only_inherit, and limit_inherit controls. For each entry, you can have a group or single user's ACL entry apply to new child files, new child folders, or both. Further, you can control inheritance on a per-folder level, and manage how deeply that inheritance goes (limit_inherit) or whether the permissions are only inheritable.
    For example, your example POSIX group permissions would look like this using two ACLs:
    ourgroup allow readattr,readextattr,readsecurity,list,search,read,execute, write,delete,append,deletechild,add_file,add_subdirectory,writeextattr,writeattr,file_inherit,directoryinherit
    Again, my ACL Tips post explains more, and my answer to this post clarifies how new files, copied files, and moved files/folders get their POSIX and ACL permissions: http://discussions.apple.com/thread.jspa?messageID=3188259&#3188259
    Hope this helps!
    --Gerrit

  • What's the best way to delete 2.4 million of records from table?

    We are having two tables one is production one and another is temp table which data we want to insert into production table. temp table having 2.5 million of records and on the other side production table is having billions of records. the thing which we want to do just simple delete already existed records from production table and then insert the remaining records from temp to production table.
    Can anyone guide what's the best way to do this?
    Thanks,
    Waheed.

    Waheed Azhar wrote:
    production table is live and data is appending in this table on random basis. if i go insert data from temp to prod table a pk voilation exception occured bcoz already a record is exist in prod table which we are going to insert from temp to prod
    If you really just want to insert the records and don't want to update the matching ones and you're already on 10g you could use the "DML error logging" facility of the INSERT command, which would log all failed records but succeeds for the remaining ones.
    You can create a suitable exception table using the DBMS_ERRLOG.CREATE_ERROR_LOG procedure and then use the "LOG ERRORS INTO" clause of the INSERT command. Note that you can't use the "direct-path" insert mode (APPEND hint) if you expect to encounter UNIQUE CONSTRAINT violations, because this can't be logged and cause the direct-path insert to fail. Since this is a "live" table you probably don't want to use the direct-path insert anyway.
    See the manuals for more information: http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_9014.htm#BGBEIACB
    Sample taken from 10g manuals:
    CREATE TABLE raises (emp_id NUMBER, sal NUMBER
       CONSTRAINT check_sal CHECK(sal > 8000));
    EXECUTE DBMS_ERRLOG.CREATE_ERROR_LOG('raises', 'errlog');
    INSERT INTO raises
       SELECT employee_id, salary*1.1 FROM employees
       WHERE commission_pct > .2
       LOG ERRORS INTO errlog ('my_bad') REJECT LIMIT 10;
    SELECT ORA_ERR_MESG$, ORA_ERR_TAG$, emp_id, sal FROM errlog;
    ORA_ERR_MESG$               ORA_ERR_TAG$         EMP_ID SAL
    ORA-02290: check constraint my_bad               161    7700
    (HR.SYS_C004266) violatedIf the number of rows in the temp table is not too large and you have a suitable index on the large table for the lookup you could also try to use a NOT EXISTS clause in the insert command:
    INSERT INTO <large_table>
    SELECT ...
    FROM TEMP A
    WHERE NOT EXISTS (
    SELECT NULL
    FROM <large_table> B
    WHERE B.<lookup> = A.<key>
    );But you need to check the execution plan, because a hash join using a full table scan on the <large_table> is probably something you want to avoid.
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/

  • Best way to set up home network using Time Capsule

    Hi
    My current home network consists of Macbook Pro 17 connected wirelessly, another Mac and few pcs. I have a Time Capsule, new netgear router and several hard drives. At the moment my main drive is plugged in via usb to the mac, however id like to set up a proper mini network where i can at least share several drives between macs, HOWEVER i also want to back up this data via TC, which is why at the moment my hard drive is plugged into the mac, so it can be backed up. Am i correct is saying that TC will not backup netwrok drives?
    ..any suggestions for best way to set up a network with TC backing up drives?
    Thanks

    paulsutt wrote:
    Am i correct is saying that TC will not backup network drives?
    Yes.
    ..any suggestions for best way to set up a network with TC backing up drives?
    You could share the locally-connected drive.  That would require that your Mac be on whenever any other network client needed to access the drive.

  • Best way to generate one record per day from a table with eff/exp dates

    Hi,
    Have a table which has various attributes and an eff and exp date. e.g attributea, 01/05/2012, 16/05/2012
    We wish to create another table from this table to have one record per day. e.g 16 records.
    What is best way to achieve this in OWB ?
    Thanks

    Hi,
    Example if have table
    with following contents
    conversion_rate number(6,4)
    EFFEcTIVE_DATE DATE
    expiration_date date
    example record 1.43, 01/05/2012,16/05/2012
    If want to have another table which instead has 16 records one for each day
    e.g
    1.43, 01/05/2012
    1.43,02/05/2012
    1.43,16/05/2012
    Thoughts on best way to do this.
    Thanks

  • The best way to know if you a  data  in a table

    hello
    I have a doubt what 's the best way to know if you have a value in a table .For example I have a table called Vehicle , that have two rows id and name . Well I want to know before do somthing if the vehicle with mane '11111', exist or not .
    Nowadays i do this operation with a : select count ( id ) into num from vehicle;
    This is the best way ???
    THANKS

    Hello
    Well here's an alternative that may help in your situation. The idea is that you put all of your values that you will be testing for the existence of, in a collection. Then use INTERSECT to find out which of those are already present in the table.
    It may well turn out to be completely useless, but I'm trying to avoid working on what I am supposed to be working on, and I thought I'd try it out ;-)
    CREATE TABLE dt_test_vehicle(veh_name     VARCHAR2(20));
    INSERT INTO dt_test_vehicle values('1111');
    INSERT INTO dt_test_vehicle values('2222');
    INSERT INTO dt_test_vehicle values('4444');
    INSERT INTO dt_test_vehicle values('5555');
    INSERT INTO dt_test_vehicle values('6666');
    CREATE TYPE dt_tt_varchar2 IS TABLE OF VARCHAR2(20)
    set serveroutput on
    DECLARE
         ltt_Params     dt_tt_varchar2;
         ltt_Result     dt_tt_varchar2;
    BEGIN
         ltt_Params := dt_tt_varchar2();
         ltt_Params.EXTEND(4);
         ltt_Params(1) := '1111';
         ltt_Params(2) := '2222';
         ltt_Params(3) := '3333';
         ltt_Params(4) := '4444';
         SELECT
              veh_name
         BULK COLLECT INTO
              ltt_Result
         FROM
              (SELECT
                   veh_name
              FROM
                   dt_test_vehicle
              INTERSECT
              SELECT
                   column_value
              FROM
                   TABLE(CAST(ltt_Params AS dt_tt_varchar2))
         IF ltt_Result.COUNT > 0 THEN
              FOR li_Idx IN ltt_Result.FIRST..ltt_Result.LAST LOOP
                   dbms_output.put_line(ltt_Result(li_Idx));
              END LOOP;
         ELSE
              dbms_output.put_line('Nothing there, everything is good to go');
         END IF;
    END;Delete rows from the test table to see the changing results. The main reason I was thinking of this way of doing it was so you could handle your messages in one hit rather than having to have a separate exception for each parameter you are testing.
    HTH
    David
    Sorry, I just re-read your post, and you need to know if these parameters are NOT there, in which case you should give an error. In that case, you could change the INTERSECT for MINUS. If you have anything in the resulting collection, these are the parameters that are missing from the table.
    Message was edited by:
    david_tyler

  • Best way of extracting Akai-CD for use in Kontakt

    What's the best way of doing it so it preserves the original data? Google only shows old results.

    Page 87 of the Kontakt manual (that's Kontakt 4).
    Might be an idea to post something like this on a Native Instruments forum ;-)

  • What is the best way to get the end of record from internal table?

    Hi,
    what is the best way to get the latest year and month ?
    the end of record(KD00011001H 1110 2007  11)
    Not KE00012002H, KA00012003H
    any function for MBEWH table ?
    MATNR                 BWKEY      LFGJA LFMON
    ========================================
    KE00012002H        1210             2005  12
    KE00012002H        1210             2006  12
    KA00012003H        1000             2006  12
    KD00011001H        1110             2005  12
    KD00011001H        1110             2006  12
    KD00011001H        1110             2007  05
    KD00011001H        1110             2007  08
    KD00011001H        1110             2007  09
    KD00011001H        1110             2007  10
    KD00011001H        1110             2007  11
    thank you
    dennis
    Edited by: ogawa Dennis on Jan 2, 2008 1:28 AM
    Edited by: ogawa Dennis on Jan 2, 2008 1:33 AM

    Hi dennis,
    you can try this:
    Sort <your internal_table MBEWH> BY lfgja DESCENDING lfmon DESCENDING.
    Thanks
    William Wilstroth

  • Best way to archive projects for future use

    I use Adobe Premiere Pro CS4,but this is a more generic question.  I shoot videos that people want to save for a long time.  I burn my projects to DVD's (or Blue-ray discs if the client does not mind the cost).  DVD's can be destroyed, lost, wear out.  What is the best way to preserve these memories?  I know that some people charge the client and use a dedicated external hard drive for each project.  What technique is not too expensive, but will last the longest?
    Thanks,
    Lisa

    OK, I meant to tack this question with my last one, my client wants me to take her 1 hour video and compress it to a format that she can store/watch on her own hard drive.  What format would retain audio and video quality best, and not be enormous and still be able to run on a computer (ie not burned to a DVD or Blu-ray Disc)?
    Second part to this question:
    one of my projects is 5 years old - not done on a external hard drive - which means that I can no longer access the project for conversion purposes.  What choices do I have  if I only have a DVD disc to convert to a file that can play/be stroed on a computer?
    Thanks

  • What's the best way to handle the growth of the mdm.tblTransaction table?

    Can anyone suggest a good way to handle the growth of the mdm.tblTransaction table? This table logs all the MDS transactions and the history of the data residing in it is required for auditing purposes. Hence we can't delete this data. I'm looking for options
    on how we can maitain this table ongoing. It is going to perform badly eventually. We currently have 15 Million transactions in this table.
    What options can we look at?

    In the vnext sql server, MDS will support cleaning based on log retention policy.
    In the sql2014/sql2012, you have to clean up the table manually.
    An sample sproc that can be reused is attached below.
    ==============================================================================
    Copyright (c) Microsoft Corporation. All Rights Reserved.
    ==============================================================================
    SELECT * FROM mdm.tbl_7_TR where LastChgDTM < '2014-10-22';
    EXEC mdm.udpLogCLeanup 7, '2014-10-22';
    SELECT * FROM mdm.tbl_7_TR where LastChgDTM < '2014-10-22';
    CREATE PROCEDURE mdm.udpTransactionsCleanup
    @Model_ID INT,
    @CleanupOlderThanDate DATE
    WITH EXECUTE AS N'mds_schema_user' -- Execute as a user that has permission to select on [tblUserGroupAssignment], [tblBRBusinessRule], [udfSecurityUserBusinessRuleList]
    AS BEGIN
    SET NOCOUNT ON
    DECLARE
    @SQL NVARCHAR(MAX)
    --Annotation table names
    ,@TransactionTableName sysname
    ,@AnnotationTableName sysname;
    SET @TransactionTableName = 'tblTransaction';
    SET @AnnotationTableName = 'tblTransactionAnnotation';
    BEGIN TRY
    --Delete all Annotations on transactions being deleted issues
    SET @SQL = N'
    DELETE [mdm].' + QUOTENAME(@AnnotationTableName) + N'
    FROM [mdm].' + QUOTENAME(@AnnotationTableName) + N' as tannt
    JOIN [mdm].'+ QUOTENAME(@TransactionTableName) + N' as txn ON tannt.Transaction_ID = txn.ID
    JOIN [mdm].[tblModelVersion] as tmv ON txn.Version_ID = tmv.ID
    WHERE tmv.Model_ID= @Model_ID AND txn.LastChgDTM <= @CleanupOlderThanDate
    EXEC sp_executesql @SQL, N'@Model_ID INT, @CleanupOlderThanDate DATE', @Model_ID, @CleanupOlderThanDate;
    --Delete all transactions older than the specified date
    SET @SQL = N'
    DELETE [mdm].' + QUOTENAME(@TransactionTableName) + N'
    FROM [mdm].' + QUOTENAME(@TransactionTableName) + N' txn
    JOIN [mdm].[tblModelVersion] tmv ON (txn.Version_ID = tmv.ID)
    WHERE tmv.Model_ID = @Model_ID AND txn.LastChgDTM <= @CleanupOlderThanDate
    EXEC sp_executesql @SQL, N'@Model_ID INT, @CleanupOlderThanDate DATE', @Model_ID, @CleanupOlderThanDate;
    RETURN(0);
    END TRY
    --Compensate as necessary
    BEGIN CATCH
    -- Get error info
    DECLARE
    @ErrorMessage NVARCHAR(4000),
    @ErrorSeverity INT,
    @ErrorState INT;
    EXEC mdm.udpGetErrorInfo
    @ErrorMessage = @ErrorMessage OUTPUT,
    @ErrorSeverity = @ErrorSeverity OUTPUT,
    @ErrorState = @ErrorState OUTPUT;
    RAISERROR(@ErrorMessage, @ErrorSeverity, @ErrorState);
    --On error, return NULL results
    --SELECT @Return_ID = NULL;
    RETURN(1);
    END CATCH;
    SET NOCOUNT OFF
    END --proc
    GO

Maybe you are looking for