[NEWSboard IBMi Forum]

Hybrid View

  1. #1
    Registriert seit
    Apr 2005
    Beiträge
    385
    Versteh auch nicht, warum eine HostVariable mit SQL geändert werden soll. Da kann man im RPG doch auch die BiF %REPLACE() benutzen?!

  2. #2
    Registriert seit
    Feb 2001
    Beiträge
    20.695
    Da es da einen kleinen Unterschied gibt:

    %REPLACE(replacement string: source string{:start position {:source
    length to replace}}

    %REPLACE returns the character string produced by inserting a replacement string into the source string,
    starting at the start position and replacing the specified number of characters.

    Du meinst da wohl eher diese Funktion:

    %SCANRPL(scan string : replacement : source { : scan start { : scan length } )

    %SCANRPL returns the string produced by replacing all occurrences of the scan string in the source
    string with the replacement string. The search for the scan string starts at the scan start position and
    continues for the scan length. The parts of the source string that are outside the range specified by the
    scan start position and the scan length are included in the result.

    Die aber erst ab irgend einem Release kam.
    Des weiteren kommt es immer auf den Einsatz an. Wenn ichmit SQL mischen muss, nehme ich doch gleich SQL, da das Ergebnis einer Bif erst in eine Variable muss.
    Dienstleistungen? Die gibt es hier: http://www.fuerchau.de
    Das Excel-AddIn: https://www.ftsolutions.de/index.php/downloads
    BI? Da war doch noch was: http://www.ftsolutions.de

  3. #3
    Registriert seit
    Apr 2005
    Beiträge
    385
    Ja ich meinte natürlich %SCANRPL verwechselte ich auch immer in der Implementierung
    Welche übringens mit V7R1 Einzug hielt...

    Ich gebe dir Recht Fuerchau, wenn es im SQL geht dann mach es auch da, aber da hier in dem Bsp eine Hostvariable geändert werden soll, kann ich das auch gleich im RPG machen und dann anschließend die in dem SQL Statements weiter zu nutzen.

  4. #4
    Registriert seit
    Feb 2001
    Beiträge
    20.695
    Wich ich schon sagte: Betrachte das Gesamtkonstrukt.
    In diesem Fall braucht man weder eine zusätzliche Variable noch dynamisches SQL:

    exec sql update myfile set myfield = replace(: MyField, 'P', 'L')
    where myfield = upper(: MyField);

    was den (relativ hohen) Aufwand des vorherigen Konstrukts vereinfachte.
    Dienstleistungen? Die gibt es hier: http://www.fuerchau.de
    Das Excel-AddIn: https://www.ftsolutions.de/index.php/downloads
    BI? Da war doch noch was: http://www.ftsolutions.de

Similar Threads

  1. Sql REPLACE
    By tarkusch in forum NEWSboard Programmierung
    Antworten: 1
    Letzter Beitrag: 29-07-17, 11:24
  2. create or replace table
    By dibe in forum IBM i Hauptforum
    Antworten: 11
    Letzter Beitrag: 11-11-16, 09:59
  3. Replace im CL
    By Joe in forum NEWSboard Programmierung
    Antworten: 5
    Letzter Beitrag: 18-05-15, 07:20
  4. RUNSQL Host Variable zurückgeben
    By oulbrich in forum NEWSboard Programmierung
    Antworten: 10
    Letzter Beitrag: 02-04-14, 11:05
  5. SQL0314, Host-Variable nicht eindeutig
    By gue_br in forum IBM i Hauptforum
    Antworten: 7
    Letzter Beitrag: 26-02-14, 15:40

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • You may not post attachments
  • You may not edit your posts
  •