SQL and the Q Q string manipulation

I'm trying to find out if I can use the manipulation of SQL strings in a Q Q. Here is an example of what I'm trying to do:

< cfquery dbtype = "query" name = "supportstatements_order" >
Select *, right (SupportStatements.Name, 12) as short_name
Of SupportStatements
Order by name
< / cfquery >

I get an error in CF I have an incorrect select statement.

Is it possible to do with Q of Q?

Thank you very much.

Anyone know if I could use queryaddcolumn in this situation?

Gather your themes led to the next suggestion

Erratum edit: data type correct varchar added

Tags: ColdFusion

Similar Questions

  • Using of the dynamic SQL and the cursor in a procedure

    Here is the procedure:
    create or replace
    Procedure type_paiement_total
    is
    
        cursor xbtable is select table_name from user_tables where table_name like 'XB%';
        n_table user_tables.table_name%type;
        req     varchar2(256);
        journal varchar2(2);
        mois varchar2(2);
        an varchar2(2);
      begin
        for n_table in xbtable
        loop
          execute immediate 'insert into xx_jk_xb (
          clie_code,journal, periode,origine, xb_ecri,xb_libe  ,dos_code,xb_debi,xb_cred,xb_term
    )
    select c.code,  
    substr(:1,3,2),
    substr(:1,7,2)||substr(:1,5,2)||,
    :1,  
    xb.ecri,  
    xb.libe,  
    d.code,
    xb.debi,
    xb.cred,
    xb.terme
    from                      
    '||n_table.table_name ||' xb,
    dossier d,                      
    client c                    
    where xb.cmpt=''4111''                    
    and xb.doss  =d.code                    
    and c.code   =d.clie
    and c.role=''1''' using n_table.table_name;
          execute immediate 'insert into xx_jk_logxb (recnum,xb_ref,trsf) values (seq_logmreg.nextval,:1,''OK'')' using n_table.table_name;
          commit;
          fetch xbtable into n_table;
        end loop;
      end;
    What he does (or what I intend to do)
    take the datas of a whole bunch of pictures and put them in the "XX_JK_XB" table and make a log of the tables covered in xx_jk_logxb give just the source table and the status (OK).
    Now when I run the procedure I get a "missing expression" th ' immediate «insert into xx_jk...»» »

    I just can't tell what is the problem here.

    clues?

    Seems to me that you are wrong assuming that the binding can be done by name and no position when you use immediate enforcement.

    Example:

    SQL> create table foo_tab( c1 varchar2(10), n1 number );
    
    Table created.
    
    SQL>
    SQL> begin
      2          for i in 1..10
      3          loop
      4                  execute immediate 'insert into foo_tab values( to_char(:1), :1 )' using i;
      5          end loop;
      6          commit;
      7  end;
      8  /
    begin
    *
    ERROR at line 1:
    ORA-01008: not all variables bound
    ORA-06512: at line 4
    
    SQL>
    SQL>
    SQL> begin
      2          for i in 1..10
      3          loop
      4                  execute immediate 'insert into foo_tab values( to_char(:1), :1 )' using i,i;
      5          end loop;
      6          commit;
      7  end;
      8  /
    
    PL/SQL procedure successfully completed.
    
    SQL>
    

    As you can see, 1 PL/SQL block attempts to re - use bind variable: 1 new - and only link once.

    Fact does not work like that - you must link it again. Binding is done by bind - 1 position = 1 to the help of var, 2nd = 2nd bind using var, etc.. Name of the connection variable used is irrelevant and not unique.

  • Limit the size and the content of string

    I was wondering if there is an easy way, predefined limit the number of characters, and what characters are allowed in a string.  I want to limit a string of 20 characters and does not allow for the apostrophe, comma, etc..  I'm sure I can this program, but thought it might already be something I could use?

    Asked several times in the past. Have you tried a search: http://forums.ni.com/t5/forums/searchpage/tab/message?location=Node%3A170&q=limit+string+length#mess...

  • help creation of sql and the column concatenation.

    Hello I have a table that looks like this

    CREATE TABLE "TEST1"
       (    "TEST1_ROLE" VARCHAR2(100 BYTE),
        "TEST1_VENDOR_NUMBER" VARCHAR2(100 BYTE)
       )
    
    

    It has these data

    INSERT INTO "TEST1" (TEST1_ROLE, TEST1_VENDOR_NUMBER) VALUES ('student', '910241630')
    INSERT INTO "TEST1" (TEST1_ROLE, TEST1_VENDOR_NUMBER) VALUES ('staff', '910241630')
    INSERT INTO "TEST1" (TEST1_ROLE, TEST1_VENDOR_NUMBER) VALUES ('employee', '910241630')
    
    

    I would like to create a query where I summarized basically from the seller _number and I'd end up with all the roles in a line

    Like this

    910241630     student,staff, employee
    
    

    I'm having a very difficult time trying to make this can someone please give me a pointer on how I would do this.

    Hello

    This sounds like a job for the aggregate LISTAGG function:

    SELECT test1_vendor_number

    LISTAGG (test1_role, ",") THE Group (ORDER BY test1_role) AS role_list,

    OF test1

    GROUP BY test1_vendor_number

    ;

    This will produce a separate line of output for each separate test1_vendor_number.

  • Query, PL/SQL and V$ SESSION.sql_address

    I am running a procedure on a database of GR 11, 2 through a PL/SQL script in Linux-side SQLPlus. The procedure makes an insertion, and then ends.

    For the first few minutes, a join between V$ SQL_SESSION.sql_address and V$ SQL_TEXT.address for this SID returns SQL procedure for its insertion.

    However, it then suddenly returns "no rows found." A glance in V$ SESSION shows that V$ SESSION record of the SID has sql_address '00 ". The SQL insert statement appears in V$ SQL, and the table to which the procedure is inserting data still holds a lock on this subject.

    Is this a normal behavior?

    -Don

    Yes.

    All SQL can be reused, the purpose of the shared pool is to share sql analyzed between sessions. That's why the SQL remains in the shared pool and is visible through v$ sql.
    An address '00' sql means that no SQL statement is running.
    Locks will be released by a later commit or rollback. Note: you should engage a logical work unit, so not all records.

    ----------
    Sybrand Bakker
    Senior Oracle DBA

  • SQL * more: how string manipulation on the input parameter?

    Hi people,

    I will be grateful if you could help me create a sql (NOT a bash script!) script that uses a substring of the input parameter to a file name that will be rolled up into stuff.

    example:

    -sample.sql

    which can be used as:

    -$ sqlplus/nolog @sample.sql abcd_efgh

    and the script works similar to the pseudo-code below:

    "...

    file_name = 'test_ ' | substr ("& 1 ', 6)

    name of spool file

    ...

    spool off

    "

    Thank you

    Babak

    Hello

    I found a solution:

    "

    ...

    column new_value filename filename

    Select "test_". filename substr('&1',6)

    Double;

    coil & filename

    ...

    spool off

    ..."

  • How to use String Manipulation Cloud Connector to shoot the first five characters of the field? (Expression syntax experience)

    The question

    I need to segment data on a large number of Postal Codes, usually about 400 to 600 at the same time. It is that our postcode field includes the last four digits in some cases, for example 92101-1957. When you use the Contact filter 'Value In A' I'm not able to do this 92101 *, 92102 * and of course I can't account for any combination of four numbers that might appear.

    The Solution - in theory

    The solution I came up with that is to create a new field of Contact in Eloqua 'Segmentation Zip Code' copy of the 5 digits of the postal Code field and execute segmentation using this new field.

    The Solution - Cloud Connector

    String Manipulation cloud connector must be able to perform this action - copy on the first 5 digits of the zip in the zip segment field field.

    When I'm stuck - via cloud connector

    I can't figure out how to write the syntax for expressions to search and replace. I have read the instructions of syntax and am still unable to establish exactly what I enter in the "regex to find: ' and the ' Regular Expressions to replace:

    Does anyone have expierence with an Expression syntax that might help train these expressions?

    Any ideas on other ways to address the problem would be too great.

    Thank you

    Louis

    Hi Louis,.

    Okay, I think I might know how to do it now but don't have access to Eloqua for the moment, so I'm kind of make this Store, but try below.

    Use the regex below in the "Regex for find" and let the "Regex to replace white": "."

    -(.*)$

    This will be after the hyphen and the replacement string will be empty, so I hope you should be left with just the first five digits that you can map to a new field.

    Let me know how you get on, I might be able to test myself so tomorrow so I'll see if I can make it work.

    Chris

  • The elements and the SQL Types

    I just started learning apex and I'm confused about the application and page elements. Since they can serve as a kind of variables in the SQL and PL/SQL (for example, by using the syntax variables bind), at some point they should be prescribed a type, since SQL and PL/SQL are two strongly typed languages.

    It seems that the items have types, see the documentation (http://docs.oracle.com/cd/E11882_01/appdev.112/e11947/bldapp.htm#BCEDCGGH), but I don't know how they correspond to the SQL types.

    For example, I saw that to_date is always used with items of type date picker, implying that it is a string of SQL type.

    So the question. What have SQL type apex page/application parts, is what type conversion do I need to use when dealing with items in SQL and PL/SQL?

    They are all VARCHAR2 (4000) as far as I know - anything application are the same and the page elements is adjustable in number or date more. Put date or number will include only internal validation, check whether the format is match the parameters of globalization of applications.

    Denes Kubicek
    -------------------------------------------------------------------
    http://deneskubicek.blogspot.com/
    http://www.Apress.com/9781430235125
    http://Apex.Oracle.com/pls/Apex/f?p=31517:1
    http://www.Amazon.de/Oracle-Apex-XE-Praxis/DP/3826655494
    -------------------------------------------------------------------

  • Strange thing in the SQL and PL/SQL

    Hi all

    I meet a very strange thing of the length of the string in SQL and PL/SQL.
    I ran the length of the string SQL and PL/SQL. The output values do not match.
    Can you please help me on how this happens?

    SQL
    select LENGTH ( '!w0n5hn:  0.1 qlpgz-P0h1txtn-tk68-..1tk81-!A_kh0nlw_P0hphn0ln kh0nlw P0hphn0ln
    zyntwm qlpgz – P0h1txtn 0n1 B00n1n – T00xk-..2 pwqt50wmwntn zt0ttn Pwn15nl pwlw0nw
    tk pwfw0wnxw1 Extwnn5hn hf: T00xk ..1 qlpgz-P0h1txtn-tk77-!A_P0hphn0ln_B0hwnw0
    Annhx50tw1 tkpn 
    P05m00y Axth0n 
    zwxhn100y Axth0n 
    gwnx05pt5hn  zx0wwn 1
     
     
     
     
    
    zx0wwn 2
     
     
     
     
     
     
     
     
    
    zx0wwn .
     
     
     
     
     
     
     
     
    
    zx0wwn !
     
     
     
     
     
     
     
     
    
    zx0wwn 5
     
    
    P0w-khn15t5hnn ed Thw tnw0 m0y l0tnxh thw kh0nlw P0hphn0l f0x5l5t5wn hy nwlwxt5nl thw kh0nlw !0ltw ftnxt5hn hn thw p0hphn0ln h0hwnw0
    Phnt khn15t5hnn ed Fhllhw5nl thw ntxxwnnftl kh0nlw hf 0 15xt5hn00y xh0nnwl p0hphn0l, thw nyntwm x0005wn htt fhllhw5nl 0xt5hnn:
    eded Thw xh0nlw1 !0ltw 5n nh lhnlw0 0!05l0hlw fh0 nwlwxt5hn 1t05nl 5twm m05ntwn0nxw; thw nyntwm thw0why p0w!wntn thw !0ltw hw5nl 0nn5lnw1 th 0115t5hn0l 5twmn
    edmq Thw xh0nlw1 !0ltw 5n 0wmh!w1 f0hm 0ll 5twmn hn wh5xh 5t 5n p0wnwnt 0n1 0wpl0xw1 hy thw tnw0 npwx5f5w1 0wpl0xwmwnt; whw0w th5n 5mp0xtn 1w05!w1, 5twm-lw!wl fl0ln, ntxh 0n “pwn15nl 0tthh05n0t5hn”, thw nyntwm 0lnh 0mwn1n thwnw fl0ln 
    ed.. Thw xh0nlw1 !0ltw p0hphn0l 5n 011w1 th thw pwjwxtw1 P0hphn0ln l5h000y, 0lhnl w5th thw xh0nlw x0twlh0y 0n1 0w0nhn th0t 00w npwx5f5w1 hy thw tnw0 5n thw xh0nlw !0ltw 150lhl
    ed!. An 0 0wntlt hf 0wmh!5nl thw xh0nlw1 !0ltw f0hm 0ll 5twmn, 0ll tn0lwn hf thw xh0nlw1 !0ltw 00w, hf xht0nw, 0wmh!wed  Th5n 5nw!5t0hly 0wntltn 5n thw 0wmh!0l hf 0ll p0hphn0ln 5n!hl!5nl thw xh0nlw1 !0ltw 5n 0ll hthw0 xh0nnwln.  Thw 0115t5hn hf 0 nww !0ltw th thwnw 5twmn m0y, hf xht0nw, x0w0tw 0 nww p0hphn0l.  Thwnw p0hphn0ln 00w nht 0tthm0t5x0lly 0tthh05nw1 0n 0 0wntlt hf thw xh0nlw !0ltw 0xt5hn; thwy mtnt hw 01m5n5ntw0w1 hy thw 0pp0hp050tw 0tthh05nw0 5n 0 nwp000tw 0xt5hn
    ed5. An w-m05l nht5f5x0t5hn 5n 1wl5!w0w1 th thw tnw0 whh x0w0tw1 thw p0hphn0l 0n1 th 0ny 0tthh05nw0n whh h0!w 0l0w01y 0tthh05nw1 thw p0hphn0l 5n thw wh0kflhw
    mq Fhllhw5nl thw ntxxwnnftl kh0nlw hf 0 mh1tlw, lhx0l Pk h0 !0ltw-p050 xh0nnwl p0hphn0l, thw nyntwm x0005wn htt fhllhw5nl 0xt5hnn:
    mqed Thw xh0nlw1 !0ltw 5tnwlf 5n 0wt05nw1 5n thw 15xt5hn00y
    mqmq Thw !0ltw 5n 0wmh!w1 f0hm 0ll 5twmn hn wh5xh thw p0hphn0l (NB. thw p0hphn0l, nht thw !0ltw) 5n p0wnwnt 0n1 0wpl0xw1 hy thw tnw0 npwx5f5w1 0wpl0xwmwnt; whw0w th5n 5mp0xtn 1w05!w1, 5twm-lw!wl fl0ln, ntxh 0n “pwn15nl 0tthh05n0t5hn”, thw nyntwm 0lnh 0mwn1n thwnw fl0ln.  In thw x0nw hf !0ltw-p050 p0hphn0ln, hnly thw p0hphn0l !0ltw th0t w0n nwlwxtw1 5n thw p0hphn0ln h0hwnw0 m0y hw xh0nlw1 (5f thw tnw0 w5nhwn th xh0nlw thw hthw0 !0ltw 5n thw p050, thwy mtnt 0xxwnn thw n0mw p050 p0hphn0l !50 th0t !0ltw 5n thw p0hphn0ln h0hwnw0)
    mq.. Thw tn0lw p0hphn0l 5n 011w1 th thw pwjwxtw1 P0hphn0ln l5h000y, 0lhnl w5th thw 0wjwxt5hn x0twlh0y 0n1 0w0nhn th0t 00w npwx5f5w1 hy thw tnw0 5n thw 0wjwxt5hn 150lhl.  Thw 0wpl0xwmwnt !0ltw th0t w0n 0ppl5w1 5n thw xh0nlw 5n 0lnh 0wxh01w1 pw0m0nwntly, nh th0t th5n x0n hw 15npl0yw1 th tnw0n whw0w 0pp0hp050tw 1t05nl 5twm xh15nl 0xt5!5ty
    mq!. An 0 0wntlt hf 0wmh!5nl thw xh0nlw1 !0ltw f0hm nhmw 5twmn, hthw0 tn0lwn hf thw !0ltw m0y 0lnh hw 0wmh!wed  If th5n 5n thw x0nw, 0n1 5f thwnw tn0lwn 00w 0lnh p0hphn0ln, th5n 0lnh 0wntltn 5n thw 0wmh!0l hf p0hphn0ln 5n!hl!5nl thw !0ltw 5n hthw0 tn0lw xh0nnwln (5t 5n w!wn 0 0wmhtw phnn5h5l5ty th0t xh0nl5nl 0 lhx0l Pk p0hphn0l m0y 0wmh!w 0 tn0lw 0n1 p0hphn0l fh0 thw n0mw !0ltw 5n 0nhthw0 lhx0l Pk; n5m5l00ly xh0nl5nl 0 !0ltw p050 m0y 0wmh!w hthw0 !0ltw-p050 tn0lwn/p0hphn0ln).  z5m5l00ly, thw 0115t5hn hf 0 nww !0ltw th 5twmn 0n 0 0wntlt hf thw xh0nlw 0xt5hn, m0y lwnw00tw nww p0hphn0ln 5n 0ny tn0lw xh0nnwl
    mq5. An w-m05l nht5f5x0t5hn 5n 1wl5!w0w1 th thw tnw0 whh x0w0tw1 thw p0hphn0l 0n1 th 0ny 0tthh05nw0n whh h0!w 0l0w01y 0tthh05nw1 thw p0hphn0l 5n thw wh0kflhw
    .. zww 5mplwmwnt0t5hn nhtwn hwlhw, tn1w0 “pwl0tw1 Infh0m0t5hn” 
    B0n5x Flhw 
     fl1l1fl1fl;lj0n1khfh0njkfhzgJKkf xhy0w0ttj 0nwhtj5y0w0hlwfklj0w0lklt5h5hn1fhlj1fhljn1fhlj1fhljwj50w0ytlt5w0j0w5t5
    ztfl!n1fllw0t!qww0wh00wwjh0f0n1jfhn1jkkwjhqw5t! tjt5w0yttwn1fln1ln1fn1') from dual;
    Here, I got an error like
    ORA-01704: string literal too long
    01704. 00000 -  "string literal too long"
    *Cause:    The string literal is longer than 4000 characters.
    *Action:   Use a string literal of at most 4000 characters.
               Longer values may only be entered using bind variables.
    Error at Line: 1 Column: 16
    But in PL/SQL,.
    BEGIN
         dbms_output.put_line(LENGTH ( '!w0n5hn:  0.1 qlpgz-P0h1txtn-tk68-..1tk81-!A_kh0nlw_P0hphn0ln kh0nlw P0hphn0ln
    zyntwm qlpgz – P0h1txtn 0n1 B00n1n – T00xk-..2 pwqt50wmwntn zt0ttn Pwn15nl pwlw0nw
    tk pwfw0wnxw1 Extwnn5hn hf: T00xk ..1 qlpgz-P0h1txtn-tk77-!A_P0hphn0ln_B0hwnw0
    Annhx50tw1 tkpn 
    P05m00y Axth0n 
    zwxhn100y Axth0n 
    gwnx05pt5hn  zx0wwn 1
     
     
     
     
    
    zx0wwn 2
     
     
     
     
     
     
     
     
    
    zx0wwn .
     
     
     
     
     
     
     
     
    
    zx0wwn !
     
     
     
     
     
     
     
     
    
    zx0wwn 5
     
    
    P0w-khn15t5hnn ed Thw tnw0 m0y l0tnxh thw kh0nlw P0hphn0l f0x5l5t5wn hy nwlwxt5nl thw kh0nlw !0ltw ftnxt5hn hn thw p0hphn0ln h0hwnw0
    Phnt khn15t5hnn ed Fhllhw5nl thw ntxxwnnftl kh0nlw hf 0 15xt5hn00y xh0nnwl p0hphn0l, thw nyntwm x0005wn htt fhllhw5nl 0xt5hnn:
    eded Thw xh0nlw1 !0ltw 5n nh lhnlw0 0!05l0hlw fh0 nwlwxt5hn 1t05nl 5twm m05ntwn0nxw; thw nyntwm thw0why p0w!wntn thw !0ltw hw5nl 0nn5lnw1 th 0115t5hn0l 5twmn
    edmq Thw xh0nlw1 !0ltw 5n 0wmh!w1 f0hm 0ll 5twmn hn wh5xh 5t 5n p0wnwnt 0n1 0wpl0xw1 hy thw tnw0 npwx5f5w1 0wpl0xwmwnt; whw0w th5n 5mp0xtn 1w05!w1, 5twm-lw!wl fl0ln, ntxh 0n “pwn15nl 0tthh05n0t5hn”, thw nyntwm 0lnh 0mwn1n thwnw fl0ln 
    ed.. Thw xh0nlw1 !0ltw p0hphn0l 5n 011w1 th thw pwjwxtw1 P0hphn0ln l5h000y, 0lhnl w5th thw xh0nlw x0twlh0y 0n1 0w0nhn th0t 00w npwx5f5w1 hy thw tnw0 5n thw xh0nlw !0ltw 150lhl
    ed!. An 0 0wntlt hf 0wmh!5nl thw xh0nlw1 !0ltw f0hm 0ll 5twmn, 0ll tn0lwn hf thw xh0nlw1 !0ltw 00w, hf xht0nw, 0wmh!wed  Th5n 5nw!5t0hly 0wntltn 5n thw 0wmh!0l hf 0ll p0hphn0ln 5n!hl!5nl thw xh0nlw1 !0ltw 5n 0ll hthw0 xh0nnwln.  Thw 0115t5hn hf 0 nww !0ltw th thwnw 5twmn m0y, hf xht0nw, x0w0tw 0 nww p0hphn0l.  Thwnw p0hphn0ln 00w nht 0tthm0t5x0lly 0tthh05nw1 0n 0 0wntlt hf thw xh0nlw !0ltw 0xt5hn; thwy mtnt hw 01m5n5ntw0w1 hy thw 0pp0hp050tw 0tthh05nw0 5n 0 nwp000tw 0xt5hn
    ed5. An w-m05l nht5f5x0t5hn 5n 1wl5!w0w1 th thw tnw0 whh x0w0tw1 thw p0hphn0l 0n1 th 0ny 0tthh05nw0n whh h0!w 0l0w01y 0tthh05nw1 thw p0hphn0l 5n thw wh0kflhw
    mq Fhllhw5nl thw ntxxwnnftl kh0nlw hf 0 mh1tlw, lhx0l Pk h0 !0ltw-p050 xh0nnwl p0hphn0l, thw nyntwm x0005wn htt fhllhw5nl 0xt5hnn:
    mqed Thw xh0nlw1 !0ltw 5tnwlf 5n 0wt05nw1 5n thw 15xt5hn00y
    mqmq Thw !0ltw 5n 0wmh!w1 f0hm 0ll 5twmn hn wh5xh thw p0hphn0l (NB. thw p0hphn0l, nht thw !0ltw) 5n p0wnwnt 0n1 0wpl0xw1 hy thw tnw0 npwx5f5w1 0wpl0xwmwnt; whw0w th5n 5mp0xtn 1w05!w1, 5twm-lw!wl fl0ln, ntxh 0n “pwn15nl 0tthh05n0t5hn”, thw nyntwm 0lnh 0mwn1n thwnw fl0ln.  In thw x0nw hf !0ltw-p050 p0hphn0ln, hnly thw p0hphn0l !0ltw th0t w0n nwlwxtw1 5n thw p0hphn0ln h0hwnw0 m0y hw xh0nlw1 (5f thw tnw0 w5nhwn th xh0nlw thw hthw0 !0ltw 5n thw p050, thwy mtnt 0xxwnn thw n0mw p050 p0hphn0l !50 th0t !0ltw 5n thw p0hphn0ln h0hwnw0)
    mq.. Thw tn0lw p0hphn0l 5n 011w1 th thw pwjwxtw1 P0hphn0ln l5h000y, 0lhnl w5th thw 0wjwxt5hn x0twlh0y 0n1 0w0nhn th0t 00w npwx5f5w1 hy thw tnw0 5n thw 0wjwxt5hn 150lhl.  Thw 0wpl0xwmwnt !0ltw th0t w0n 0ppl5w1 5n thw xh0nlw 5n 0lnh 0wxh01w1 pw0m0nwntly, nh th0t th5n x0n hw 15npl0yw1 th tnw0n whw0w 0pp0hp050tw 1t05nl 5twm xh15nl 0xt5!5ty
    mq!. An 0 0wntlt hf 0wmh!5nl thw xh0nlw1 !0ltw f0hm nhmw 5twmn, hthw0 tn0lwn hf thw !0ltw m0y 0lnh hw 0wmh!wed  If th5n 5n thw x0nw, 0n1 5f thwnw tn0lwn 00w 0lnh p0hphn0ln, th5n 0lnh 0wntltn 5n thw 0wmh!0l hf p0hphn0ln 5n!hl!5nl thw !0ltw 5n hthw0 tn0lw xh0nnwln (5t 5n w!wn 0 0wmhtw phnn5h5l5ty th0t xh0nl5nl 0 lhx0l Pk p0hphn0l m0y 0wmh!w 0 tn0lw 0n1 p0hphn0l fh0 thw n0mw !0ltw 5n 0nhthw0 lhx0l Pk; n5m5l00ly xh0nl5nl 0 !0ltw p050 m0y 0wmh!w hthw0 !0ltw-p050 tn0lwn/p0hphn0ln).  z5m5l00ly, thw 0115t5hn hf 0 nww !0ltw th 5twmn 0n 0 0wntlt hf thw xh0nlw 0xt5hn, m0y lwnw00tw nww p0hphn0ln 5n 0ny tn0lw xh0nnwl
    mq5. An w-m05l nht5f5x0t5hn 5n 1wl5!w0w1 th thw tnw0 whh x0w0tw1 thw p0hphn0l 0n1 th 0ny 0tthh05nw0n whh h0!w 0l0w01y 0tthh05nw1 thw p0hphn0l 5n thw wh0kflhw
    .. zww 5mplwmwnt0t5hn nhtwn hwlhw, tn1w0 “pwl0tw1 Infh0m0t5hn” 
    B0n5x Flhw 
     fl1l1fl1fl;lj0n1khfh0njkfhzgJKkf xhy0w0ttj 0nwhtj5y0w0hlwfklj0w0lklt5h5hn1fhlj1fhljn1fhlj1fhljwj50w0ytlt5w0j0w5t5
    ztfl!n1fllw0t!qww0wh00wwjh0f0n1jfhn1jkkwjhqw5t! tjt5w0yttwn1fln1ln1fn1') );
    END;
    I got the value as 3969.

    I tried with the same string. I know that the maximum length of the SQL string is 4000 and PL/SQL is 32767. but the thing is when am a length of the string in PL/SQL as less than 4000, then iwhy must not be run alongside SQL?

    Can you help me out on this issue?

    DB: Oracle 11g Release 2

    Thank you and best regards,
    Suresh.

    Suresh Mohan says:

    Outside chr (256), are there other characters of white space available?

    White space characters are listed on http://en.wikipedia.org/wiki/Whitespace_character.

    From the point of view of the old MS-MS-BACK/ASCII characters, a white space character was #256 as the chariot of normal space was #32. He was also a space compared to a difficult space.

    You need to look at the character set you use - ASCII is a set of characters in a single byte, and not the same thing.

    You can use the SQL DUMP() function to watch the characters in a string. For example

    select dump( my_string_column ) from my_table where ...
    
  • Get the bind variables name string SQL or the cursor

    Hello

    Is there way to get of the bind variables name string SQL or the cursor?

    Example of
    DECLARE
      l_sql VARCHAR2(2000);
      desctab DBMS_SQL.DESC_TAB;
      curid   PLS_INTEGER;
    BEGIN
    
      l_sql := 'SELECT * FROM emp WHERE mgr = :X and deptno = :Y';
    
      curid := dbms_sql.open_cursor;
      dbms_sql.parse(curid, l_sql, dbms_sql.NATIVE);
      ....
    END;
    What I mean with the SQL string:
    I love to get using some functions from above code variable l_sql all the bind variable.
    In this case the function should return array where is for example: X and: Y

    Back to bind the cursor variable names, I mean same but rather string I pass number of cursor.

    Y at - it sucks ready function or some may share a code customized for this purpose?

    Thanks

    Kind regards
    Jari

    http://dbswh.webhop.NET/dbswh/f?p=blog:Home:0Regards,

    Published by: jarola December 19, 2011 02:44

    I found there are wwv_flow_utilities.get_binds of the function not documented in APEX packages that do what I want.
    Usage example
    set serveroutput on
    DECLARE
      binds DBMS_SQL.varchar2_table;
    BEGIN
      binds := wwv_flow_utilities.get_binds('select :P1_TEST from dual');
      FOR i IN 1 .. binds.count
      LOOP
        dbms_output.put_line(binds(i));
      END LOOP;
    END;
    /
    
    anonymous block completed
    :P1_TEST
    But I would not use these functions without papers as those who can change or there is no future versions APEX.
    Is there a documented function or the custom function that do the same thing as wwv_flow_utilities.get_binds?

    Some old basic example code of my friends. Also the media getting the bind variable of PL/SQL code blocks anon.

    SQL> create or replace function GetBindVariables( statement varchar2 ) return TStrings is
      2          --// bind variables names are terminated by one the following special chars
      3          SPECIAL_CHAR    constant TStrings := TStrings(' ',')','+','-','>','<','*',',','=',';',CHR(10),CHR(13));
      4
      5          --// max size of a bind var name
      6          MAX_VARSIZE     constant integer := 100;
      7
      8          pos     integer;
      9          pos1    integer;
     10          occur   integer;
     11          varName varchar2(100);
     12          varList TStrings;
     13  begin
     14          varList := new TStrings();
     15
     16          --// looking for the 1st occurance of a bind variable
     17          occur := 1;
     18
     19          loop
     20                  pos := InStr( statement, ':', 1, occur );
     21                  exit when pos = 0;
     22
     23                  varName := SubStr( statement, pos, 100 );
     24
     25                  --// find the terminating char trailing the
     26                  --// bind variable name
     27                  pos1 := Length( varName );
     28                  for i in 1..SPECIAL_CHAR.Count
     29                  loop
     30                          pos := InStr( varName, SPECIAL_CHAR(i) ) - 1;
     31                          if (pos > 0) and (pos < pos1) then
     32                                  pos1 := pos;
     33                          end if;
     34                  end loop;
     35
     36                  --// extract the actual bind var name (without
     37                  --// colon char prefix)
     38                  varName := SubStr( varName, 2, pos1-1 );
     39
     40                  --// maintain a unique list of var names
     41                  if not varName member of varList then
     42                          varList.Extend(1);
     43                          varList( varList.Count ) := varName;
     44                  end if;
     45
     46                  --// look for the next occurance
     47                  occur := occur + 1;
     48          end loop;
     49
     50          return( varList );
     51  end;
     52  /
    
    Function created.
    
    SQL>
    SQL> select
      2          column_value as BIND_VAR
      3  from TABLE(
      4          GetBindVariables('select * from foo where col=:BIND1 and day = to_date(:B2,''yyyy/mm/dd'')')
      5  );
    
    BIND_VAR
    ------------------------------
    BIND1
    B2
    
    SQL> 
    

    PS. just realize this code is case-sensitive, while variable bind is not. Should throw a upper() or lower() by adding the name of the var to the list - never really a problem for me because I'm pretty tense when it use cases correctly in the code. ;-)

    Published by: Billy Verreynne, December 19, 2011 06:19

  • String manipulation SQL query

    Starting with the data for this example:
    GET sampledata
    WITH sampledata AS
         (SELECT 'THIS Information Collection GL Enquiry User' resp
            FROM DUAL
          UNION ALL
          SELECT 'THIS Information Collection PO Web Requisitioner and Receiver'
            FROM DUAL
          UNION ALL
          SELECT 'THIS Asset Management Team GL Enquiry User'
            FROM DUAL        
          UNION ALL
          SELECT 'THIS Asset Management Team PO Web Requisitioner and Receiver'
            FROM DUAL
          UNION ALL
          SELECT 'THIS Collections GL Enquiry User'
            FROM DUAL
          UNION ALL
          SELECT 'THIS Collections PO Web Requisitioner and Receiver'
            FROM DUAL)
    SELECT *
      FROM sampledata;
    I am trying to find a way to get the first section of chain BEFORE and also the little after that, including 2 letter string - for example I would like to extract:
    BEFORE                          | AFTER
    --------------------------------------------------------------------------------
    THIS Information Collection     | GL Enquiry User
    THIS Information Collection     | PO Web Requisitioner and Receiver
    THIS Asset Management Team      | GL Enquiry User
    THIS Asset Management Team      | PO Web Requisitioner and Receiver
    THIS Collections                | GL Enquiry User
    THIS Collections                | PO Web Requisitioner and Receiver
    However, I am rather stuck - I think I will need to use a combination of INSTR() and SUBSTR(), but the problem is that the 2 letter string appears after a variable number of words, so there is no ordinary way to check where to appear the 2 letters - more the 2 letter string will be different each time - not only GL and PO as above , but one range of others, for example, AR, AP, etc. OM.

    Any advice much appreciated.

    Thank you!

    Like this?

    SQL> ed
    Wrote file afiedt.buf
    
      1  WITH sampledata AS
      2       (SELECT 'THIS Information Collection GL Enquiry User' resp FROM DUAL UNION ALL
      3        SELECT 'THIS Information Collection PO Web Requisitioner and Receiver' FROM DUAL UNION ALL
      4        SELECT 'THIS Asset Management Team GL Enquiry User' FROM DUAL UNION ALL
      5        SELECT 'THIS Asset Management Team PO Web Requisitioner and Receiver' FROM DUAL UNION ALL
      6        SELECT 'THIS Collections GL Enquiry User' FROM DUAL UNION ALL
      7        SELECT 'THIS Collections PO Web Requisitioner and Receiver' FROM DUAL)
      8  SELECT regexp_replace(resp,'^(.*) [^ ]{2} .*$','\1') as resp1
      9        ,regexp_replace(resp,'^.* ([^ ]{2} .*)$','\1') as resp2
     10*   FROM sampledata
    SQL> /
    
    RESP1                                    RESP2
    ---------------------------------------- ----------------------------------------
    THIS Information Collection              GL Enquiry User
    THIS Information Collection              PO Web Requisitioner and Receiver
    THIS Asset Management Team               GL Enquiry User
    THIS Asset Management Team               PO Web Requisitioner and Receiver
    THIS Collections                         GL Enquiry User
    THIS Collections                         PO Web Requisitioner and Receiver
    
    6 rows selected.
    
  • Help of query SQL - inner joins and the separate results

    Hello

    ASP VB, SQL Server

    I have a structure of data base with 3 tables - users, albums and photos. each user has a identifier unique, each record has a unique albumid and also contains a column with the user name. each record in the photo has a unique id so that store the user name and the album in which the image belongs.

    I'm writing a query that returns a list of the albums for a particular user (based on a user name query string) and who will also bring back the id of the first record in the table for each of these albums photo.

    the closest I get is to run a query to select albumid albums where userid = varuserid with a join internal on the pictures table to remove the photo ID - problem I then it comes out all the photos from the photos table where userid = varuserid, so when I do a repeat region to display a list of albums for a certain user It produces a list of all the photos where userid = varuserid

    I really want to return just a list of ID album based on the username variable, but also to return the first record in the table of photos for each of these albumids

    I tried different combinations of inner joins, select distinct etc but no joy.

    any suggestion would be appreciated as am floundering here...




    First, you must define 'first' with regard to the photos. Is there a
    timestamp? They are numbered inside the album? Do you really care who is
    "first", or do you want simply a shot? You also neglected to indicate if they are
    empty photo albums have been allowed. I assumed that the empty albums are not
    allowed.

    Whatever you decide, the answer will be similar.
    SQL Server tends to get better results with joins with subqueries. You will have
    See such a written request more often with subqueries, and there isn't
    nothing wrong with that, but I'll use a join on a derived table. I have
    have not all column names (hint, hint), so I made them, but the
    Comments should help out you.

    SELECT A.Title, P.PhotoID, P.Caption, A.AlbumID, P.ImagePath
    FROM dbo. A albums
    -build a table derived, consisting of photo ID lowest for each
    album.
    INNER JOIN (SELECT AlbumID, MIN (PhotoID) AS FirstPhoto FROM dbo. Photos
    AlbumID GROUP) AS PM WE A.AlbumID = PM. AlbumID
    -details of the photo for the photo shown in the table above
    INNER JOIN dbo. Photos P on A.AlbumID = P.AlbumID AND
    H. FirstPhoto = P.PhotoID
    User A.UserID ='some WHERE '

    "tedstar" wrote in message
    News:ee4pfn$de$1@forums. Macromedia.com...
    > I am writing a query that returns a list of the albums for a
    > particular user (based on a user name query string) and also bring
    > return
    > the id of the first record in the table for each of these albums photo.

  • number of words and the release of n words in string

    Hello. I use the following script to output n number of records of a description string "longdescription" - type varchar 8000chrs in sql server 2000

    < cfset teaser = ">
    < cfset temp longdescription = >
    < CFLOOP from = "1" to = "26" index 'i' = >
    < cfset teaser =
    ListAppend (teaser, ListFirst (temp,' '),' ') >
    < cfset temp = ListRest (temp,' ') >
    < / CFLOOP >
    #teaser #.

    It works without problem until I want to display a large number of records on a page, it takes 10 seconds to display records with a fairly long description (2000 characters +) 60, (it's definitely the only factor during the long wait as eliminated all others) can anyone think that of any ways alternatives/functions to more effectively , keeping in mind, I don't want to put an end to the chain on a split Word

    Thank you very much

    Oli

    Hi Dan, thanks for the reply, the 'left' function works a treat, and thanks to your pointers on this one, I did a bit of googleing and found some info on sql do all the work, goes it the word count/dear one loop and comes the number of intelligent characters space, while sql and fast v - soft!

    SELECT LEFT (longdescription, CHARINDEX (' ', longdescription, 280)) as shorterdescription, table

    see you soon

  • How do I in the sql and pl/sql?

    I have the following data in a table:

    Cust_Id Relation_ID
    1 2
    1 3
    2 3
    1 v
    5 7
    6 7
    7 8
    8 9

    for customer 1 is connected to client 2 somehow (could be the husband, for example) and is also linked to the customer 3. Client 2 is related to the customer, 3 3 client is then linked to the customer 4. Similarly, visitors 5,6,7,8 and 9 are all connected, but they are in no way related to customers 1,2,3 and 4.

    I need to divide these data into related groups. So clients 1,2,3 and 4 in 1 (say Group 1), and customers 5,6,7,8 and 9 would be in another (say Group 2). Of course, this is a simple example, but my real data are more than that!
    In theory, client 1 might also be in another 'group', say with the customers, 10, 11 and 12, that would not be associated with anyone in the Group 1. This would then form another group (say 3).

    How I did it and communicate the results in sql/pl sql?

    Hello

    Tracey.Sheppard wrote:
    My apologies - I'm one of these groups a little bit, which would have confused the issue further.

    Groups must be:

    Customer 195229 (father) Group: (father is 195229 no 195226!)
    195229
    195224
    201147
    195228
    195226

    Son, daughter, and mother of group
    195224
    195228
    195229
    195226

    Group of friends of 11807
    11807
    201147

    A group of friend of 201147
    201147
    195229
    11807

    For each customer, the group is their cust_id more people that they are directly related.

    If a group consists of a node and all other nodes connected directly.
    That is, x and are in the same group if (and only if) at least one of the following is true:
    (1) cust_id = x and reln_id = y for a relationship line.
    (2) reln_id = x and cust_id = y for a relationship line, or
    (3) x = y
    Is this fair?

    If I do:

    Select distinct (decode(cust_id,'195226',reln_id,cust_id))
    in the relationship where (cust_id = ' 195226 'or reln_id = ' 195226')

    I get:

    DECODE (C
    --------
    195224
    195228
    195229

    so 195226 group is foregoing plus 195226.

    I don't think it's useful to think of "the 195226 group." Haven't you said that an id can be member of groups of two or more systematically? Aren't say you, below, that "195226 group' is equivalent to 'of 195224 group', and that the two are the same as"195228 group?

    The same query, but with 295228 gives:

    DECODE (C
    --------
    195224
    195226
    195229

    so when 195228 is added, the group is the same. Here in a single group.

    You are on the right track. Associate each node with all nodes connected directly to it, as well as to himself. It's that the subquery in the query below got_memebers. Note the similarity between got_members and the definition I gave to a group above.

    WITH     got_members     AS
    (
         SELECT     cust_id  AS id1,   reln_id  AS id2     FROM relation     UNION
         SELECT     reln_id  AS id1,   cust_id  AS id2     FROM relation     UNION
         SELECT     cust_id  AS id1,   cust_id  AS id2     FROM relation     UNION
         SELECT     reln_id  AS id1,   reln_id  AS id2     FROM relation
    )
    ,     got_r_num     AS
    (
         SELECT     id1
         ,     id2
         ,     ROW_NUMBER () OVER ( PARTITION BY  id1
                                   ORDER BY          id2
                           )  AS r_num
         FROM     got_members
    )
    SELECT DISTINCT      SUBSTR ( SYS_CONNECT_BY_PATH (id2, ',')
                           , 2
                   ) AS grp
    FROM           got_r_num
    WHERE           CONNECT_BY_ISLEAF     = 1
    START WITH      r_num          = 1
    CONNECT BY      r_num          = PRIOR r_num + 1
         AND      id1          = PRIOR id1
    ;
    

    The main query uses String aggregation to obtain a unique identifier for each group. (The unique ID used above is the list separated by commas of the members in alphabetical order.) Got_r_num of the subquery is useful for making string using CONNECT BY aggregation. If you use another method of aggregation of the chain, you shouldn't have this subquery. (On my system, I would use the STRAGG function defined by the user, that is found in)
    http://asktom.Oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:2196162600402
    .)

    Please test (and correct, if necessary) any code before you post.
    INSERT statements you posted all contain errors: the word "INSERT INTO * TABLE * relationship...» ». Reln_to and reln_of are each defined as VARCHAR2 (4), but almost all the values you are trying to use more than 4 characters.

    With the data for this example:

    CREATE TABLE relation (
    cust_id varchar2(8),
    reln_to varchar2(8),
    reln_id varchar2(8),
    reln_of varchar2(8) );
    
    INSERT INTO relation(cust_id, reln_to, reln_id, reln_of) VALUES('195228', 'MOTHER',   '195226', 'SON');
    INSERT INTO relation(cust_id, reln_to, reln_id, reln_of) VALUES('195229', 'FATHER',   '195226', 'SON');
    INSERT INTO relation(cust_id, reln_to, reln_id, reln_of) VALUES('195229', 'FATHER',   '195224', 'DAUGHTER');
    INSERT INTO relation(cust_id, reln_to, reln_id, reln_of) VALUES('195226', 'BROTHER',  '195224', 'SISTER');
    INSERT INTO relation(cust_id, reln_to, reln_id, reln_of) VALUES('195228', 'WIFE',     '195229', 'HUSBAND');
    INSERT INTO relation(cust_id, reln_to, reln_id, reln_of) VALUES('195228', 'DAUGHTER', '195224', 'MOTHER');
    INSERT INTO relation(cust_id, reln_to, reln_id, reln_of) VALUES('11807',  'FRIEND',   '201147', 'FRIEND');
    INSERT INTO relation(cust_id, reln_to, reln_id, reln_of) VALUES('201147', 'FRIEND',   '195229', 'FRIEND');
    

    the above query gives these results:

    GRP
    -----------------------------------------------------
    11807,195229,201147
    195224,195226,195228,195229
    11807,201147
    195224,195226,195228,195229,201147
    

    This assumes that the output will only contain related items. What happens if you have some entitiy which is not linked to another entity in your application? If you want to include "Islands" like this in your output, you must include them in the data somehow. The best way is probably to have a separate table that had a line per node, if not he was connected to all other nodes. Another way would be to have a line in the relationship that binds each otherwise node not connected to itself.

  • SQL in pl/sql and create the duplicate RMAN script.

    Hello

    I'm new to pl/sql and I am trying to write a script that will generate RMAN commands to make a clone of database.

    I want to be able to run the script, and he invited me to the variables to be used in the script.

    I did some research but I have been unable to find examples of how to proceed.

    Basic script is (it would be obviously a lot more to the final script):

    declare

    dbname varchar2 (9): = & dbname;

    BEGIN
    DBMS_OUTPUT. ENABLE (2000);
    DBMS_OUTPUT. Put_line (' DUPLICATE TARGET DATABASE to ' | dbname |) ';') ;
    end;
    /

    Makes me:

    Enter the value of dbname: ORCL4
    old 3: dbname varchar2 (9): = & dbname;
    new 3: dbname varchar2 (9): = ORCL4;
    dbname varchar2 (9): = ORCL4;
    *
    ERROR at line 3:
    ORA-06550: line 3, column 24:
    PLS-00201: identifier 'ORCL4' must be declared.
    ORA-06550: line 3, column 9:
    PL/SQL: Ignored Element
    ORA-06550: line 7, column 66:
    PLS-00320: the declaration of the type of the expression is incomplete or incorrect
    ORA-06550: line 7, column 9:
    PL/SQL: Statement ignored

    Thank you
    Tom.

    Hi, Tom.

    When SQL * more variable substitution resolves, it puts the string you gave as value (ORCL4 for example) instead of the string representing the name (& dbname, for example). East exaclty what you could do using the Replace function in a text editor: nothing more.
    After SQL * more substituted for these channels, it send s the text changed the database to be compiled. So, where you coded:

    dbname varchar2(9) := &dbname;
    

    is that it sends to compile

    dbname varchar2(9) := ORCL4;
    

    in other words, it looks like a variable on the side right of the: = sign.

    You must provide quotes:

    dbname varchar2(9) := '&dbname';
    

Maybe you are looking for

  • Microsoft Security Essentials OR Windows Defender

    What is the difference between Microsoft Security Essentials and Windows Defender

  • Malware and other viruses, download problem, IE is hacked?

    I ran anti virus programs, they found horses of Trojans, spyware software, root kit and pirate PUM. They were "out" I used Avast, he found nothing, I used bytes ware bad, and he concluded that all of the above, I chose to delete. But I can not open I

  • My computer does not recognize a wireless mouse

    Suddenly, my wireless mouse doesn't work.  It's a HP that came with the computer.  The mouse and the keyboard, both connect to the same USB.  I tried a different mouse and that no longer works.  I tried to use two mice on another computer and they wo

  • How can run foxprow.exe on windows 7 not in xp

    Dear Sir. He I have a foxprow.exe in an accounting program (Dolphin), I buy a laptop running windows 7, that he could not work because my laptop ex was in windows xp. why I got this problem? How can I solve it?

  • Windows 8 - security settings

    I found that when I joined my microsoft with Windows 8 apps (particularly e-mail) account, he diverted all my security settings. A sign that you have this problem is if you go to settings-> users PC and the button change under "any user with a passwo