Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8062977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T10:51:47+00:00 2026-06-05T10:51:47+00:00

I keep getting a error when i run this code, What wrong with the

  • 0

I keep getting a error when i run this code, What wrong with the code?

create or replace function f_vars(line varchar2,delimit varchar2 default ',')
return line_type is type line_type is varray(1000) of varchar2(3000);
sline varchar2 (3000);
line_var line_type;

pos number;
begin
sline := line;
for i in 1 .. lenght(sline)
loop

pos := instr(sline,delimit,1,1);
if pos =0 then
line_var(i):=sline;
exit;

endif;
string:=substr(sline,1,pos-1);
line_var(i):=string;
sline := substr(sline,pos+1,length(sline));

end loop;
return line_var;
end;

LINE/COL ERROR


20/5 PLS-00103: Encountered the symbol “LOOP” when expecting one of
the following:
if

22/4 PLS-00103: Encountered the symbol “end-of-file” when expecting
one of the following:
end not pragma final instantiable order overriding static
member constructor map

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T10:51:49+00:00Added an answer on June 5, 2026 at 10:51 am

    Stack Overflow isn’t really a de-bugging service.

    However, I’m feeling generous.

    You have spelt length incorrectly; correcting this should fix your first error. Your second is caused by endif;, no space, which means that the if statement has no terminator.

    This will not correct all your errors. For instance, you’re assigning something to the undefined (and unnecessary) variable string.


    I do have more to say though…

    I cannot over-emphasise the importance of code-style and whitespace. Your code is fairly unreadable. While this may not matter to you now it will matter to someone else coming to the code in 6 months time. It will probably matter to you in 6 months time when you’re trying to work out what you wrote.

    Secondly, I cannot over-emphasise the importance of comments. For exactly the same reasons as whitespace, comments are a very important part of understanding how something works.

    Thirdly, always explicitly name your function when ending it. It makes things a lot clearer in packages so it’s a good habit to have and in functions it’ll help with matching up the end problem that caused your second error.

    Lastly, if you want to return the user-defined type line_type you need to declare this _outside your function. Something like the following:

    create or replace object t_line_type as object ( a varchar2(3000));
    create or replace type line_type as varray(1000) of t_line_type;
    

    Adding whitespace your function might look something like the following. This is my coding style and I’m definitely not suggesting that you should slavishly follow it but it helps to have some standardisation.

    create or replace function f_vars ( PLine in varchar2
                                      , PDelimiter in varchar2 default ','
                                        ) return line_type is 
    
       /* This function takes in a line and a delimiter, splits
          it on the delimiter and returns it in a varray.
          */
    
       -- local variables are l_
       l_line varchar2 (3000) := PLine;
       l_pos number;
    
       -- user defined types are t_
       -- This is a varray.
       t_line line_type;
    
    begin
    
       for i in 1 .. length(l_line) loop
    
          -- Get the position of the first delimiter.
          l_pos := instr(l_line, PDelimiter, 1, 1);
    
          -- Exit when we have run out of delimiters.
          if l_pos = 0 then
             t_line_var(i) := l_line;
             exit;
          end if;
    
          -- Fill in the varray and take the part of a string
          -- between our previous delimiter and the next.  
          t_line_var(i) := substr(l_line, 1, l_pos - 1);
          l_line := substr(l_line, l_pos + 1, length(l_line));
    
       end loop;
    
       return t_line;
    
    end f_vars;
    /
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I run the following code, I keep getting this error: Traceback (most recent
I keep getting this error after my code has run between 5-10 min CallbackOnCollectedDelegate
I keep getting this error when I run my web app (asp.net mvc) in
I keep getting this error saying that it cannot find my javascript function checkpw().
I keep getting this error from my code and I have no idea what
G'day folks I keep getting the error above whenever I run this and buggered
I keep getting this error when I run the program. Object reference not set
So I keep getting this error when trying to compile C++ code using CodeBlocks.
When I try to run privoxy, I keep getting this error can't check configuration
I keep getting the following error when trying to run a login script I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.