Skip to Main Content

PL SQL equivalent for mentioned VB code

User_FRTCMApr 3 2014 — edited Apr 3 2014

Hi,

I have converted a part of the below code from VB to SQL logic, could I get some more help on the rest. Could I please get the conversion for below :-

If InStr(str1, ",") = 0 Then

                k = Len(LTrim(RTrim(str1)))

                If (k < 4) Then

                ' space for other chars

                    ln = "INSERT INTO ATION (ATION,CODES) VALUES('" & rSt1(1) & "', '" & Left(str1, 4)  & Space(4 - k) & ",    ,    ,    ,')"

                Else

                ' take only 4chars

                    ln = "INSERT INTO ATION (ATION,CODES) VALUES('" & rSt1(1) & "', '" & Left(str1, 4) & ",    ,    ,    ,')"

                End If

Converted part :-

If InStr(V_CODES, ',') = 0 Then

                k := LENGTH(LTrim(RTrim(V_CODES)));

                If (k < 4) Then

                  --space for other chars

                  INSERT INTO ATION (ATION,CODES) VALUES(V_ATION, SUBSTR(V_CODES, 4) || RPAD(4 - k) & ",    ,    ,    ,')

                Else

                ' take only 4chars

                 INSERT INTO ATION (ATION,CODES) VALUES(V_ATION, 'Left(str1, 4)  & ",    ,    ,    ,')"

                End If

Thanks, I just want to be sure about the code. Help & advice appreciated

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked due to inactivity on May 1 2014
Added on Apr 3 2014
11 comments
268 views