Re: Prepare statement in SPL
Posted in 2001
At 11:35 01/01/15 +0100, Pike wrote:
I'm sorry very much.
It seems to be able to use the Prepare sentence only with ESQL/C.
Hereafter, it is an excerpt of the manual.
PREPARE
Use the PREPARE statement to parse, validate, and generate an execution
plan for SQL statements at runtime.
Use this statement with ESQL/C.
Preparing Statements with SQL Identifiers
In general, you cannot use question-mark (?) placeholders for SQL identi-fiers.
You must specify these identifiers in the statement text when you
prepare the statement.
It will pay attention from next time.
Regards.
>Hello
>
>thanks for responding ..
>
>>How about this ?
> >in SPL
> > let mytable = "mytable";
> > let str = "select max(blah) from " || mytable;
> > prepare myquery from str;
>
>nope, the parser just barfs at the word "prepare". Syntax error (-201).
>below is the full procedure I tested.
>
> >>As in the example, I want to use a variable for a tablename, in SPL.
> >>Is there a workaround ?
>
>>================================
>>create procedure test();>> define str char(256);
>> define mytable char(256);
>>
>>
>> let mytable = "mytable";
>> let str = "select max(blah) from " || mytable;
>>
>> prepare myquery from str;
>>end procedure;
>>=================================
>
>thanks,
>*-pike
>*----------pike-------------*
>
>Instructions for Life in the new millennium (2001>) from the Dalai Lama:
>* Take into account that great love and great achievements involve great
>risk.
>* When you lose, do not lose the lesson.
>* Follow the three Rs: Respect for self, respect for others,
>responsibility for all your actions.
>* Remember that not getting what you want is sometimes a wonderful stroke
>of luck.
>* Learn the rules so you know how to break them properly.
>* Do not let a little dispute injure a great friendship.
>* When you realize you have made a mistake, take immediate steps to
>correct it.
>* Spend some time alone every day.
>* Open your arms to change, but do not let go of your values.
>* Remember that silence is sometimes the best answer.
>* Live a good, honorable life. Then, when you get older and think back,
> you will be able to enjoy it a second time.
>* A loving atmosphere in your home is the foundation for your life.
>* In disagreements with loved ones, deal only with the current
> situation. Do not bring up the past.
>* Share your knowledge. It is a way to achieve immortality.
>* Be gentle with the earth.
>* Once a year, go someplace you have never been before.
>* Remember that the best relationship is one in which your love for
> each other exceeds your need for each other.
>* Judge your success by what you had to give up in order to get it.
>* Approach love and cooking with reckless abandon.
>
>
--
Tsutomu Ogiwara
Technical Group & Red Brick Group, Informix Sales Promotion Dept
CTC, ITOCHU Techno-Science Corporation
Yasukuni Kudan-Minami Bldg., 2-3-14, Kudan-Minami Chiyoda-Ku TOKYO,
102-0074 JAPAN
Phone:+81-3-5212-4891 Fax:+81-3-5212-4889
E-mail:Tsutomu.Ogiwara@ctc-g.co.jp / tsutoo@my-deja.com