Book a Demo

Author Topic: "Too few parameters" error in SQL search  (Read 6515 times)

Gusztav

  • EA User
  • **
  • Posts: 32
  • Karma: +0/-0
  • EA expert
    • View Profile
    • Imprestige. Your issues in safe hands.
"Too few parameters" error in SQL search
« on: October 19, 2014, 04:12:16 am »
Hi,

I have created the following SQL search to get an element's details based on its name.

Code: [Select]
SELECT
      obj.Object_Type AS CLASSTYPE,
      obj.ea_guid AS CLASSGUID,
      obj.Object_ID AS OBJECTID,
      obj.Name AS [Name],      
      obj.Object_Type AS [Type],
      obj.Sterotype AS [Stereotype]
      
FROM
      t_object AS obj

WHERE
            obj.Name LIKE '%<Search Term>%'
      
ORDER BY obj.Name

Whenever I try to run the report with a name entered in the Search Term field, I got an error:

Code: [Select]
DAO.Database 3061
Too few parameters. Expected 1.

Since the parameter is set, I cannot find out what is the problem. Can anyone help?

Thanks in advance.
------------------------
Imprestige. Your issues in safe hands.

joeT

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: "Too few parameters" error in SQL search
« Reply #1 on: October 19, 2014, 03:26:29 pm »
I'll preface this with an 'I am no SQL expert"

The line
obj.Sterotype AS [Stereotype]
should be
obj.Stereotype AS [Stereotype]
i.e. Stereotype is misspelt following the obj. declaration in the SELECT statement

and I always need to put in a space after the select statement otherwise I get an DAO.QueryDef [3141] error. I don't know why?

Regards,
joeT

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: "Too few parameters" error in SQL search
« Reply #2 on: October 19, 2014, 09:03:54 pm »
Of course your observation is right.

Regarding the space after SELECT you should submit a bug report. Please state that you when you have a Return right after the SELECT EA will croak. It's likely a bug in their internal parser.

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: "Too few parameters" error in SQL search
« Reply #3 on: October 20, 2014, 05:46:06 pm »
You also shouldn't use 'AS' when defining a table alias.

Some SQL syntaxes don't allow that.
Just use
http://FROM
      t_object obj


Geert