put single quotes around data entry

Hi all

DB: 10 G

Have an input field (P10_item) with the value text sometimes, it may be that several values of text separated by, such as T-123, T-870. Sometimes, there only 1 value of text.

How to build a query that may take the article and convert the input to the following value? Using the length function, I can know how much check not in the field, but I'm lost in the way to the 'all about each check no. Help
ex:
Select * payment where checkno in ('t - 123', 't-870')



Thank you
with  t as
(select 'T-123,T-870'  txt from dual )
select replace(regexp_replace(txt,'(.+)','''\1'''),',',''',''')from t;

'T-123','T-870'

Sorry I didn't get what you wanted at first.
This p_10_item of break shoud multiple entry if it has commas in it and
then you can join him in the payout table.

WITH t AS (SELECT 'T-123,T-870' p_10_item FROM DUAL),
     t2
        AS (    SELECT REGEXP_SUBSTR (p_10_item,
                                      '[^\,]+',
                                      1,
                                      LEVEL)
                          checkno
                  FROM t
            CONNECT BY LEVEL <=
                            LENGTH (p_10_item)
                          - LENGTH (REPLACE (p_10_item, ','))
                          + 1)
SELECT payment.*
  FROM payment, t2
 WHERE t2.checkno = payment.checkno

Published by: pollywog may 18, 2011 13:14

Tags: Database

Similar Questions

  • How to put single quotes for attributes by default?

    Hello

    any idea? I can't find the settings of anywhere. I am using homesite 5.5.

    Thank you.

    It is not really an option for this.

    Here's some info I have on it, class in development applications you will notice:
    http://www.wilk4.com/asp4hs/priorityreqs.htm#SingleQuote

  • Put quotes around a Substitution Variable with MaxL

    All,

    I need to have quotation marks (that is to say, 'brands) around the value in a variable substitution for the sub. var to work inside a-> cross dimensional operator. I can add the quotes in Server | Change | variable in assessments environmental but can't make it work with the SET command alter database. It works very well with quotation marks around it, but when I check the value of the variable in the EAS do not show the quotes. If I try to put two pairs of quotation marks around it, I get an error MaxL.


    Thank you
    T.

    Single quotes around the double quotes should work for the value parameter.

  • Single quote place around a string

    Hello

    I wonder how I can put single quotation around a string in the following. I tried to double and triple quote, but do not name of the rec.tablename variable.

    any idea

    Rec.table_name == > "rec.table_name".
    Rec.column_name == > "rec.column_name".

    v_sql: = 'DELETE USER_SDO_GEOM_METADATA WHERE TABLE_NAME =' | Rec.table_name;
    immediately run v_sql;

    -Insert the record from the Table in Sdo_User_Geom_Metadata
    v_sql: = 'INSERT IN USER_SDO_GEOM_METADATA (TABLE_NAME, COLUMN_NAME, DIMINFO, SRID) |
    "VALUES (' |)" Rec.table_name | ',' || Rec.column_name | ', MDSYS. SDO_DIM_ARRAY (' |)
    'MDSYS. SDO_DIM_ELEMENT ('X',-2147483648, 2147483647,.000005), ' |
    'MDSYS. SDO_DIM_ELEMENT(''Y'',-2147483648, 2147483647,.000005)), 2958)';
    immediately run v_sql;


    Nancy

    I have 2 suggestions, a 2nd being the best choice.

    SQL> set serveroutput on
    SQL>
    SQL> declare
      2    v_sql varchar2(4000);
      3    table_name varchar2(4000);
      4  begin
      5    table_name := 'MY_TABLE';
      6    v_sql:= 'DELETE USER_SDO_GEOM_METADATA WHERE TABLE_NAME= ''' || table_name || '''';
      7    dbms_output.put_line(v_sql);
      8  end;
      9  /
    
    DELETE USER_SDO_GEOM_METADATA WHERE TABLE_NAME= 'MY_TABLE'
    
    PL/SQL procedure successfully completed
    
    SQL> 
    

    or using DBMS_ASSERT for a more elegant solution against SQL injections:

    Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.4.0
    Connected as fsitja
    
    SQL> set serveroutput on
    SQL>
    SQL> declare
      2    v_sql varchar2(4000);
      3    table_name varchar2(4000);
      4  begin
      5    table_name := dbms_assert.QUALIFIED_SQL_NAME('ALL_TABLES');
      6    v_sql:= 'DELETE USER_SDO_GEOM_METADATA WHERE TABLE_NAME= ' || dbms_assert.ENQUOTE_NAME(table_name);
      7    dbms_output.put_line(v_sql);
      8  end;
      9  /
    
    DELETE USER_SDO_GEOM_METADATA WHERE TABLE_NAME= "ALL_TABLES"
    
    PL/SQL procedure successfully completed
    
    SQL> 
    

    [Docs that references the validation checks against SQL injection | http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10472/dynamic.htm#LNPLS648]

    Kind regards
    Francisco

  • Any way to generate a single quote (') with XSLT?

    Hello:

    I guess that's really a question of XSLT. I use the XMLType variable Transform() method to apply a style sheet. The XML code in the variable is just something simple like

    < TBL >
    < name > AS | JONES < / LAST_NAME >
    < name > = | MARIE < / name >
    < AGE > = | 50 < / AGE >
    < / TBL >

    I'm trying to get a style sheet to transform something like the above SQL such as
    Select * from foo where LAST_NAME like 'JONES' 
    and FIRST_NAME ='MARY'
    and AGE = 50
    But to do this, I need to generate single quotes around search terms and I can't get anything else that
    LAST_NAME LIKE &apos;JONES&apos;
    . Is there a way to do this? Because now I'm generating a ~ and replacement ~ for ' all the SQL generated text throughout, but is a pretty sorry solution.

    I thought that something like
    <xsl:text disable-output-escaping="yes">&amp;</xsl:text>
    go to work but then is found out that he has been deprecated. I thought about character-card would work, but it's one thing to XSLT 2.0 and apparently 10g is on XSLT 1.0? In all cases, he didn't know what I was trying to do with a character map.

    So, I forget one obvious way to get my style sheet to insert apostrophes?

    Thank you.

    Comment by Marco needing dbms_xmlgen.convert was OK for 10.2.0.4. Here is an example which produces the same result, but requires dbms_xmlgen.convert when I run it on 10.2.0.4 and works as an example of Mark on 11.1.0.x.

    declare
      l_xml   XMLTYPE := XMLTYPE('
    
      
        
        
        
        
      
      
        
        
        
        
      
      
        
        
        
        
      
      
        
        
        
        
      
      
        
        
        
        
      
    ');
    
       l_xsl XMLTYPE := XMLTYPE('
    
      
      
    
    
      
        select * from
        
        where 1=1
        
          
            
            
            
              AND 
               
              
               
              
                
                  '
                  
                  '
                
                
                  '
                  
                  '
                
                
                  
                
              
            
          
        
      
    ');
    
       l_result   CLOB := '1';
    begin
      -- 10.2.0.4 version
      --l_result := dbms_xmlgen.convert(l_xml.transform(l_xsl).getStringVal(), dbms_xmlgen.ENTITY_DECODE);
      l_result := l_xml.transform(l_xsl).getStringVal();
      -- 11.1.0.6 version
      dbms_output.put_line(l_result);
    end;
    
  • Sqlldr can load data where datafilename contains single quotes?

    Hello

    The data file I want to load with SQLLDR contains single quotes as a character in the name.
    Ex: The name of file is like:

    "* / home/user/datastore/a demo'file_with_space.csv* '.

    There is a single quotes and also a space in the name of the file.

    -----

    If I use it as a character escape as follows:

    data = / home/user/datastore/a\ demo\'file_with_space.csv

    I get the following error:
    LRM-00111: no closing quote for value "file_with_space.csv".

    SQL * Loader: Release 10.2.0.1.0 - Production on Tue Dec 29 11:41:08 2009

    Copyright (c) 1982, 2005, Oracle. All rights reserved.

    SQL * Loader-100: syntax on the command line error

    -----

    If I use the double quotes from the inside (with and without the escape characters also) it crashes as
    data = "" / home/user/datastore/a demo'file_with_space.csv ' "



    Is it possible to load this file.

    Thank you
    Deeptarka

    Hello

    Why cannot you rename the file that is the best way to solve the problem instead of wasting time.

    -Pavan Kumar N
    Oracle 9i / 10g - OCP
    http://oracleinternals.blogspot.com/

  • Move the cursor to data entry in the first element of array

    It seems that it should be simple, and that I still can't find a way to do this.

    I want to have a dialogue VI with a single Berry. When loading of the dialog, I want the data entry cursor to appear in the first element of the array, so the user can begin to enter data with the keyboard and I can't click on it with the mouse and then tab on the rest of the table. The property node 'Key Focus' just seems to give me a box around the entire table without any cursor active data entry.

    A table control has a property called array element. Get a reference to it and its main objective set to true. I just spent a few minutes test this and it didn't work for me if I first got the reference, then turn the key a second property node, rather than doing everything in one implicit property node. In addition, it still affects the update to the second element of the array, which is certainly not too useful. I have not found a way around that in my brief tests, unfortunately.

  • Import of single quote + script

    Hello world

    I use FDMEE 11.2.3Hi got in my data several fields and look..., XXX, XXX',..., 2000

    I'm not even match the value XXX'XXX but it seems that I can't load data from tent to convert a nonnumeric value in number and I do not understand why.

    I tried to solve this problem with a script BefImport trying to replace the "character without success. Also, I don't know what it is bad in my syntax.

    If fdmContext ["LOCNAME'] == 'YYY ':

    fdmAPI.logInfo (fdmContext ["LOCNAME"])

    Try:

    filename = fdmContext ["FILENAME"]

    Inbox = fdmContext ["INBOXDIR"]

    fdmAPI.logInfo (filename)

    fdmAPI.logInfo (inbox)

    file = inbox + '\\YYY\\' + filename

    file_out = inbox + "\\YYY\\" + file name ".out".

    fdmAPI.logInfo (file)

    end = open (file, "r")

    who cares = open (file_out, "w")

    for the end line:

    lineIni = line.replace ("', '_')

    care. Write (lineIni)

    end. Close()

    care. Close()

    except IOError, err:

    fdmAPI.logError ("My error" + str (err))

    OS. Remove (file)

    OS. Rename (file_out, leader)

    Does anyone has any ideas on this?, why it takes "as a comma?

    Thanks and regards.

    Hello

    Yes I copied the script of the solution and turn. Now, I finished digging into it and, apparently, a single quote ' is a wildcard is solf put that------in the script before the quotation mark as follows (maybe it will be useful to someone else):

    If fdmContext ["LOCNAME'] == 'DSLWGLMulti ':
    fdmAPI.logInfo (fdmContext ["LOCNAME"])
    Try:
    filename = fdmContext ["FILENAME"]
    Inbox = fdmContext ["INBOXDIR"]
    #filedir = fdmContext ['FILEDIR']
    fdmAPI.logInfo (filename)
    fdmAPI.logInfo (inbox)
    file = inbox + '\\DSLWGLMulti\\' + filename
    file_out = inbox + "\\DSLWGLMulti\\" + file name ".out".
    #file = inbox '-' + filedir + "\\"+filename. "
    #file_out = inbox + "\" + filedir + "\\"+filename + «.out "»
    fdmAPI.logInfo (file)
    end = open (file, "r")
    who cares = open (file_out, "w")
    for the end line:
    line = line.replace('\'','')
    care. Write (Line)
    end. Close()
    care. Close()
    except IOError, err:
    fdmAPI.logError ("My error" + str (err))

    OS. Remove (file)
    OS. Rename (file_out, leader)

  • How to remove tabs, several spaces, quotes from data in the column.

    Hello

    How can we remove legs, several spaces, quotes from data in the column.

    Entry:

    H ope you 'are' Ingo w ell

    Output:

    H ope do you everything - there is a tab in hope and double-spaced in the well. This should be replaced by space. (Tab and multi spaces)

    I found myself with below:

    REGEXP_REPLACE (REGEXP_REPLACE (Replace (col, Chr (9),' '), ' () {2,} ', ' '),'[' ""]', ")

    Can we do more efficiently, your contributions are appreciated.

    I tried

    REGEXP_REPLACE (col,'[^ [a - z, A - Z, 0-9, Chr (0) - Chr (127) [: Space:]]] *', ") but the tabs still exist and that my data have German characters I can't go along with this.

    Thank you

    GVK.

    Hello

    Karthik417 wrote:

    Hello

    Thanks for your suggestion. In the above expression, we still missed to replace the double quotes.

    So thought we must use another regular expression instead of REPLACE.

    Select REGEXP_REPLACE (REGEXP_REPLACE (' H ope you "are" d "Ingo ell w ',' [' |])) CHR (9) | + ',' '),'["" "]') twice;

    I suppose we must use at least 2 REGEXP to achieve and cannot get it with a single expression.

    Thank you

    Sorry, I removed single quotes, not double - quote.  (This shows one of the reasons why having a few lines of sample data is very useful).

    I think you don't need 2 separate functions.  I do not think that the two must be REGEXP_REPLACE; You can use TRANSLATE to remove both types of quotation marks in a single function call:

    TRANSLATE (REGEXP_REPLACE (col

    , '[ ' || CHR (9) | ']+'

    , ' '

    )

    , '?'''"',

    , '?'

    )

    Of course, you can use use REGEXP_REPLACE to remove the quotes, if you really want to.

    Powerful they are, regular expressions are basically only 1 thing, things not 2 or more different.  Sometimes, he can watch as they do several things, because they can operate on character classes, like the series containing the and the and a variable number of characters.  For example, the REGEXP_REPLACE function, I used above is simply changing expression expression x y, where x is 1 consecutive or more characters of a given set.  As we both demonstrated, we can have a separate function that changes from p to q, but I know not all built-in function which, in general, can change x to y at the time that it changes from p to q.  TRANSLATE comes close, but TRANSLATE only works if x, y, p and q are single (or NULL), characters not expressions.

  • Connect / data entry

    Hello
    can someone help me to make a page that serves as a page of data entry for me?
    (I mean, have a free space for the user to type friendship as
    Name:...
    Date:...
    age:... etc...,

    and also I need to know how to record these data which are a mixture of figures & texts?

    PS: I already have a savings system in my main application that records the tensions for me when I launch the app until I have stop, but I also need to log-in data, to added somewhere, even to the same excel which saves my V?

    I agree with falkpl that put all controls in a cluster (and then possibly saving them as typedef) are the simplest user interface solution.

    To save this data to excel, you can turn your dates/numbers to strings using the standard screws in the number and range of time. Then maybe save all in the form of a table 2D with a column of labels and a data column:

    [[Name] [Michael]]

    [Date [8-17-2010 09:47]]

    etc.

    If you do a typedef of the cluster you can then create a beautiful sub - vi to do the registration for you. I have attached a validation in LV7.1 vi

  • Text box for data entry

    Hi guys,.

    I have a few areas of data entry in my GUI that I control.

    The data are entered in hexadecimal format, IE. Ox is sitting next to the text entry box and the user must enter a value between 00 and FF for a single byte.

    As soon as the user tries to enter R eg I want for a warning sound to happen and him should not be accepted by the text entry area, I also want to limit the size of a byte, that is, a person may enter FFF.

    Any help much appreciated.

    Eoin

    Use a digital control.  Change the properties to:

    Appearance: See the Radix

    DataType: U8

    Display format: hexadecimal.

    Lynn

  • the core data entry error - windows 8

    It seems to me to get the data entry error on my windows kernel 8 all the days. I ran chkdsk many times before, Defrag, reinstalled a clean copy and ran virus, malware scans.

    Kernel error of data entry displays the blue screen and restarts and is very well after the restart, but a few days later, the error will appear again. Please help on how I can fix this?
    I'm not sure as to what files I need to download. Please advice.

    ShinPark3

    They are usually related to a problem with HD.  Before running CHKDSK I would remove Avast and express cache (both are know-how BSOD)

    Avast can be a cause of BSOD.

    Please remove and use the Defender built-in at least to test

    http://files.avast.com/files/eng/aswclear5.exe

    A CHKDSK F: /R

    CHKDSK WARNING: while running chkdsk on the drive if bad sectors are found when chkdsk attempts to repair this sector all the data available in this area may be lost.

    Run CHKDSK/r/f of a high (run as administrator) command prompt.
    Do this for each hard drive on your system.
    When he tells you, he cannot do at the moment – and ask you if you do not want to do it at the next reset - answer Y (for Yes) and press ENTER.

    Then restart and let the test to run.
    It may take some time for him to run, but keep an occasional eye on it to see if it generates errors.
    http://www.howtogeek.com/HOWTO/Windows-Vista/Guide-to-using-check-disk-in-Windows-Vista/

    See "CHKDSK LogFile' below to verify the test results.

    B Elevated Command Prompt:
    Click on start and type "cmd.exe" (without the quotes)
    At the top of the search box, right-click on Cmd.exe and select "Run as Administrator"

    C CHKDSK LogFile:
    Click Start and type "eventvwr.msc" (without the quotes) and press enter
    Expand the topic the Windows logs, and then select the Application log file entry.
    Double-click the Source column heading.
    Scroll down the list until you find the entrance to Chkdsk (wininit for Win7) (winlogon for XP).
    Copy / paste the results in your next post.

  • data entry page the value "viewmode.

    I have a data entry page that I would like to allow other users to see but not change and data. APEX has a setting "viewmode" for a page or if I need to manipulate each field in the page? APEX 4.2

    ebenwalker wrote:

    Normal data entry Form. I hope to not have to put the code in each article.  Is there a method to make all the elements 'view only' with a block of code?  (pseudo-code;  If the user = clerk and establish all the elements to display only.)

    APEX 4.2 has support for read-only point, area conditions and level of the page. Put yourself in the form a screen to read-only by using a condition appropriate for the page or region level attribute.

  • Dynamic processing of single quotes in SQL

    Version: 11.2.0.4

    I'm kinda a beginner when it comes to dynamic SQL.

    I had a condition in which I had to run the following command on all the data files in the DB.

    -Expected results

    change datafile resizing '< Filename >' database 10g;

    The name of file, which is generated dynamically must be in single quotes.

    -Sample data

    create table x (file_name varchar2 (90));

    Insert into x values ('/ u04/oradata/ORCL/system.dbf');

    Insert into x values ('/ u04/oradata/ORCL/sysaux.dbf');

    Insert into x values ('/ u04/oradata/ORCL/users01.dbf');

    I managed to do it using a similair below code. But I had to do several things of trial and error to get this working in reason to get the correct number of single quotes for the string generated for v_sql below. So, I want to rethink the basics.

    declare

    v_sql varchar2 (350);

    Start

    for rec in (select x file_name)

    loop

    v_sql: = "alter database datafile"'| " Rec.file_name | " 'resize 10g;

    -RUN IMMEDIATELY v_sql;

    dbms_output.put_line (v_sql);

    end loop;

    end;

    /

    ALTER database datafile ' / u04/oradata/ORCL/system.dbf' size 10g

    ALTER database datafile ' / u04/oradata/ORCL/sysaux.dbf' size 10g

    ALTER database datafile ' / u04/oradata/ORCL/users01.dbf' size 10g

    PL/SQL procedure successfully completed.

    I would like to know the role played by each single quote. I used 8 apostrophes in the V_SQL variable above, and I numbered each single quotation mark as shown below.

    1                        234                 567           8

    |                        |||                 |||           |

    v_sql: = "alter database datafile"'| " Rec.file_name | " 'resize 10g;

    Example of output from the generation of dynamic channels:

    alter database datafile '/u04/oradata/ORCL/users01.dbf' 10g resizing

    1 and 4-> start and end of the string alter database datafile '

    3 > literal single quote of string in red in the example output

    2 > escape 3 (single literal quote of string)

    5 and 8-> start and end of the string ' resize 10 g

    6-> escape 7 (single literal quote of string)

    7 > literal single quote of string in green in the example output

    My asssumptions are correct?

    I would like to write like this.

    declare
       v_sql    varchar2(350);
    begin
      for rec in (select file_name from x)
          loop
            v_sql := q'[alter database datafile '#FILENAME#' resize 10g]';
            v_sql := replace(v_sql, '#FILENAME#', rec.file_name);
            --- EXECUTE IMMEDIATE v_sql;
            dbms_output.put_line ( v_sql);
        end loop;
    end;
    /
    
  • Generation of single quotes in strings

    Version: 11.2.0.3

    We have a custom stored procedure called GENERATE_STATS and I want to run this procedure for each schema in the comic book as

    exec ('SCOTT', 'BASIC') generate_stats;

    generate_stats exec ('HR', 'BASIC');

    .

    .

    .

    .

    exec ('XXXXXX', 'BASIC') generate_stats;

    -All except XXXXXX is fixed.

    -XXXX is derived rom DBA_USERS

    I want to generate these commands dynamically as

    SQL > SELECT ' exec generate_stats ("' | username |) (', "'BASIC"); from dba_users;

    ERROR:

    ORA-01756: city not properly finished chain

    -I noticed that, to generate a single quotation mark, you need 4 quotes

    SQL > select "' double.

    '

    -

    '

    SQL > select "',"' double.

    '''

    ---

    ','

    -I managed to create so far without much trouble.

    SQL > SELECT ' exec generate_stats ("' | username |) "',"' from dba_users where rownum < 5;

    ' EXECGENERATE_STATS('''||) USER NAME | " ','' '

    --------------------------------------------------------

    generate_stats exec ("SYS"

    exec generate_stats ("SYSTEM",")

    exec generate_stats ('OUTLN', ')

    generate_stats exec ('DIP', ')

    It took a lot of trial and error to add the remaining portiton BASIC'); to added. The following finally worked.

    SQL > SELECT ' exec generate_stats ("' | username |) (', "BASIC");' from dba_users where rownum < 5;

    ' EXECGENERATE_STATS('''||) USER NAME | " (', "BASIC"); "

    ----------------------------------------------------------------

    generate_stats exec ('SYS', 'BASIC');

    exec ('SYSTEM', 'BASIC') generate_stats;

    generate_stats exec ('OUTLN', 'BASIC');

    exec ('DIVE', 'BASIC') generate_stats;

    To generate the string 'BASIC' . I didn't have to use single quotes 4 as I once did.

    It generated when I placed between her with just two single quotes like that "BASIC");'

    There are a few basic rules I should keep in mind when you try to generate strings with single quotes?

    Hello

    In a string literal, single quotes normally indicate the beginning or the end of the literal.

    If you want to specify a single quote, is to use 2 consecutive single quotes in the literal.  For example, the name of 9 characters O'Higgins could be written in a literal string like this

    'O' Higgins

    ICT that there are 4 single quotes above: 1 to indicate the beginning of the literal string, 2 to represent a single quotation mark in the literal and 1 at the end of the literal.

    If you want a string of characters-1 that contains only a single quote, and then, as you noticed, it was released as 4 of them in a row

    ''''

    If you want to represent the 12 string

    ","BASIC");"

    in a string literal, then you have to put everything in a pair of simple and douuble quotes all quotes that occur in the sting, like this:

    (', "BASIC"); "

    When you asked if there was a rule of THUMB , you were doing a play on words?

    There is a rule of practice. When you use this type of string literal, single quotes always occur in pairs.  You always need a pair to mark the beginning and the end of the literal.  For each single quote representation, you need a pair.  If the string that represents the 12 above string literal contains 4 pairs of single quotes.  I'll write this liteal once again, with the numbers in pairs:

    (', "BASIC"); "

    122 33 44 1

    1 pair surrounds the literal; pairs of 2, 3 and 4 represent single quotes in the literal.

    If ever you have an odd number of single quotes using this notation, then you know that something is wrong.

    It is the older way of the use of single quotes in the string literal.  From Oracle 10, you have the possibility to use Q-notaation as well:

    Q'<', 'basic');="">'

    When you use Q-rating, you can have literals well trained with an odd number of single quotes.  The literal above happens to have 5, 2 that surround the literal.

    See the manual of the SQL language for more info on Q-rating:

    Literals

Maybe you are looking for