473,382 Members | 1,445 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

DB2 9.7 Function + NickName + Dynamic=> Problem

3
Good day! Sorry for my bad English! I am from Russia.

I want to write scalar function (Return String), This Function work with dynamic scripts and use NickName.
Ок.

This is Procedure, what get SQL QWERY and after dynamic work Return STRING.

Expand|Select|Wrap|Line Numbers
  1. CREATE OR REPLACE PROCEDURE TEMP.RETURN_STR
  2. (IN IN_STR   VARCHAR(32000), 
  3.  OUT OUT_STR VARCHAR(32000)
  4. LANGUAGE SQL
  5. NOT DETERMINISTIC
  6. CALLED ON NULL INPUT
  7. NO EXTERNAL ACTION
  8. OLD SAVEPOINT LEVEL
  9. READS SQL DATA
  10. INHERIT SPECIAL REGISTERS
  11. BEGIN
  12. DECLARE c1 CURSOR FOR s1;
  13. PREPARE s1 FROM IN_STR;
  14. OPEN c1;
  15. FETCH c1 INTO OUT_STR;
  16. CLOSE c1;
  17. RETURN;
  18. END;
  19.  
*/It is example function, what use NickName
FORM.FUND - it is NickName
*/

Expand|Select|Wrap|Line Numbers
  1. CREATE OR REPLACE FUNCTION TEMP.TESTSC ()
  2.   RETURNS VARCHAR(32000)
  3. LANGUAGE SQL
  4. NOT DETERMINISTIC
  5. READS SQL DATA
  6. STATIC DISPATCH
  7. CALLED ON NULL INPUT
  8. NO EXTERNAL ACTION
  9. INHERIT SPECIAL REGISTERS
  10. BEGIN ATOMIC  
  11. DECLARE STR_RESULT VARCHAR(32000);
  12. DECLARE STR_EXEC   VARCHAR(32000);
  13.  
  14. SET STR_EXEC =  'select MAX(ID_PERSON) from FORM.FUND where ID_PERSON_FUND_PARENT  <50';
  15. CALL TEMP.RETURN_STR (STR_EXEC,STR_RESULT);
  16. RETURN cast(STR_RESULT as VARCHAR(32000));
  17. END;
  18. select TEMP.TESTSC() from SYSIBM.SYSDUMMY1;
When i execute , i get error:
Lookup Error - DB2 Database Error: ERROR [55047] [IBM][DB2/NT64] SQL20136N Routine "TEMP.RETURN_STR" (specific name "SQL130322110434800") attempted to access a federated object.

Please, Help Me!
Mar 22 '13 #1
4 2038
Rabbit
12,516 Expert Mod 8TB
When allowing SQL in a procedure, you're not allowed to call a federated object.
Mar 25 '13 #2
medoed
3
Ок! Thanks!
But Procedure - in not important! I want use Nickname with dynamic in function. Why function - because i will use this function in construction from.
It is realy or i am dreamer?
Mar 26 '13 #3
Rabbit
12,516 Expert Mod 8TB
You haven't added any additional information.

You need to either not allow SQL and convert any SQL to non-SQL code or you need to find an alternative to your federated object.
Mar 26 '13 #4
medoed
3
OK! I tried select * from scalar function with nickname - no problem. I tried dinamic in function - no problem. But , when i use NickName + Dynamic in SQL function i get problem. Why?

I do'nt undestand, what you mean:
1) >>You need to either not allow SQL and convert any SQL to non-SQL code.
If You mean - java or C external function - i tried, but i get identical error.
2) >>You need to find an alternative to your federated object.
If You say about MQT - it is not good for us. MQT - is evil, on big table we have long refresh and deadlock.
Mar 27 '13 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Cezary | last post by:
Hi. I want to change language on my site online. So, I wrote this: <form action="<?= preg_replace("/&/", "&amp;", $_SERVER) ?>" method="post" name="change_lang_form"> <p...
0
by: Venus | last post by:
Hello, After trying some ways to do it I wanted to use something like the code below but for some reason is not working (I have to generate the entire form dynamically (not only the controls)):...
4
by: Fueled | last post by:
Hi everyone! I've made quite a lot of research on this, and I've tried a couple of proposed solutions. Nothing has worked for me, but I feel there's not much I'm missing. So I'm turning to this...
11
by: toton | last post by:
Hi, I have little confusion about static memory allocation & dynamic allocation for a cluss member. I have class like class Bar{ public: explicit Bar(){ cout<<"bar default"<<endl; }
16
by: deepres | last post by:
Hi, I have the following problem. In my application I'm dynamically replacing some of web-page content. For example, I have something like that: <span id="ui_tr_22_1_treeJ_span" > <div...
2
by: chobo | last post by:
Hi, I am trying to make a dynamic menu using javascript and an xml file. The structure of the page (test.html) is in the code below. When I load up the page the drop-down list is there, so I select a...
1
by: alexis.meilland | last post by:
Hello, Well, I have a problem with a dynamic debuging. My program is winform program written in Managed c++. I compile dynamically a dll in vb.net. It works well. To execute a function in...
0
by: susikto | last post by:
hi, I am getting this error when I am trying to connect the PSQL database. PHP Warning: pg_connect() : Unable to connect to PostgreSQL server: FATAL: user &quot;apache&quot; does not exist Can...
1
by: VaidehiPawar | last post by:
I am a beginner level in xml..my output page does not convert &gt &lt it shows something like this " &lt;b&gt;Location.&lt;/b&gt;&lt;br /&gt; &lt;UL&gt;&lt;LI&gt;Park Central New York " can anyone help? here is my code ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.