Please help on binding variables
Hello,
I need to bind the variable in following function.
If the single deptno is passed into function, the function will return correct result. However, if the set of deptno is passed, the function cannot give correct result.
Could anyone please help me on it...
Thanks in advance!!!
scott@ORA111>create or replace function my_test (p_deptno_list varchar2)
2 return sys_refcursor
3 as
4 rec sys_refcursor;
5 v_sql varchar2(1000);
6
7 begin
8 v_sql := 'select * from emp where deptno in (:1)';
9 open rec for v_sql using p_deptno_list;
10 return rec;
11
12 end;
13 /
Function created.
Elapsed: 00:00:00.04
scott@ORA111>var my_rec refcursor
scott@ORA111>execute :my_rec := my_test('10');
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.00
scott@ORA111>print :my_rec
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7839 KING PRESIDENT 17-NOV-81 5000 10
7934 MILLER CLERK 7782 23-JAN-82 1300 10
9999 TEMP SALESMAN 7782 27-APR-09 6000 10
Elapsed: 00:00:00.01
scott@ORA111>var my_rec refcursor
scott@ORA111>execute :my_rec := my_test('10, 20');
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.01
scott@ORA111>print :my_rec
ERROR:
ORA-12801: error signaled in parallel query server P000
ORA-01722: invalid number
no rows selected
Elapsed: 00:00:00.01
Hello Beijing,
Thank you so much for your help!!!
We need a procedure/function to take the inputs as query conditions, execute the query, store the result in refer cursor and pass it into Client Application.
With the help on this Forum, I have done following test. Only one thing that I have not figure out is the variable-list. As you know the line 15 in my procedure will not give the correct result. However, I am not able to concatenate the bind variable in the string.
Please help, thanks again.
SQL> create or replace function test_function
2 (p_deptno_list varchar2,
3 p_hire_start emp.hiredate%type,
4 p_hire_end emp.hiredate%type,
5 p_job emp.job%type)
6 return sys_refcursor
7 as
8 rec sys_refcursor;
9 v_sql varchar2(1000);
10
11 begin
12 v_sql := 'select * from emp';
13
14 if p_deptno_list is not null then
15 v_sql := v_sql ||' where instr(replace(:1, '' '', ''''), deptno) > 0';
16 else
17 v_sql := v_sql ||' where :1 is null';
18 end if;
19
20 if p_hire_start is not null and p_hire_end is not null then
21 v_sql := v_sql ||' and hiredate between :2 and :3';
22 else
23 v_sql := v_sql ||' and :2 is null and :3 is null';
24 end if;
25
26
27 if p_job is not null then
28 v_sql := v_sql ||' and job = :4';
29 else
30 v_sql := v_sql ||' and :4 is null';
31 end if;
32
33 open rec for v_sql using p_deptno_list, p_hire_start, p_hire_end, p_job;
34 return rec;
35
36 end;
37 /
Function created.
SQL> set lin 200
SQL> var rec refcursor
SQL> execute :rec := test_function(null, null, null, null);
PL/SQL procedure successfully completed.
SQL> print rec
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SMITH CLERK 7902 17-DEC-80 800 20
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30
7566 JONES MANAGER 7839 02-APR-81 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 3450 10
7788 SCOTT ANALYST 7566 19-APR-87 3000 20
7839 KING PRESIDENT 17-NOV-81 6000 10
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
7876 ADAMS CLERK 7788 23-MAY-87 1100 20
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7900 JAMES CLERK 7698 03-DEC-81 950 30
7902 FORD ANALYST 7566 03-DEC-81 3000 20
7934 MILLER CLERK 7782 23-JAN-82 4300 10
14 rows selected.
SQL> execute :rec := test_function('20, 30', null, null, null);
PL/SQL procedure successfully completed.
SQL> print rec
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SMITH CLERK 7902 17-DEC-80 800 20
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30
7566 JONES MANAGER 7839 02-APR-81 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7788 SCOTT ANALYST 7566 19-APR-87 3000 20
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
7876 ADAMS CLERK 7788 23-MAY-87 1100 20
7900 JAMES CLERK 7698 03-DEC-81 950 30
7902 FORD ANALYST 7566 03-DEC-81 3000 20
11 rows selected.
SQL> execute :rec := test_function('20', to_date('01-JAN-1981','DD-MON-YYYY'), to_date('31-DEC-1981','DD-MON-YYYY'), null);
PL/SQL procedure successfully completed.
SQL> print rec
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7566 JONES MANAGER 7839 02-APR-81 2975 20
7902 FORD ANALYST 7566 03-DEC-81 3000 20
SQL> execute :rec := test_function('20', to_date('01-JAN-1981','DD-MON-YYYY'), to_date('31-DEC-1981','DD-MON-YYYY'), 'MANAGER');
PL/SQL procedure successfully completed.
SQL> print rec
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7566 JONES MANAGER 7839 02-APR-81 2975 20
SQL> spool off
Similar Messages
-
A little bit of help with Bind variables please
Hi,
I am having a bit of trouble with bind variables I have been looking at the Dev guide and the forum to try and achieve this and it is still not happening for me, could anybody please help or point me in the right direction:
I have created a simple PersonVO with the basic query:
Select distinct full_name from xxml_people where person_id = :1
In the PersonVOImpl.java I have added the method:
public void initQuery(String personId)
Number person = null;
try
person = new Number(personId);
catch
(Exception e){}
setWhereClauseParam(1,person);
executeQuery();
Then in the PersonAM I have added the method:
public void initPersonQuery(String personId)
getPersonVO1().initQuery(personId);
I then call this method in my processRequest section of my page controller:
PersonAMImpl am = (PersonAMImpl) pageContext.getRootApplicationModule();
String personId = "581";
am.initPersonQuery(personId);
When I try and run this I get the error:
oracle.apps.fnd.framework.OAException: oracle.jbo.SQLStmtException: JBO-27122: SQL error during statement preparation. Statement: SELECT distinct full_name from xxml_absence_calendar where person_id = :1
java.sql.SQLException: ORA-01006: bind variable does not exist
Am I binding the variables correctly? Or am I making some stupid mistake?
I am ultimately looking to create a messageChoice where the logged in user will see a list of all organisations underneath him and the one level above. I plan to do this by passing the User’s Organisation name into a VO query using the organisation as a Bind Variable. I think once I have worked out how to bind variables this should be straight forward.
Many ThanksEven though the parameter binding values may be same, you should never use the positional param more than once. So always go for the format
select distinct full_name from xxml_people where supervisor_id = :1
UNION
select distinct full_name from xxml_people where person_id = :2
--Shiv -
I am very new to this site so I hope I get the format right...
I am using Oracle Application Express Edition and trying to answer a question for my class, but I keep getting the same error every time. I've looked it up and it's apparently a storage error, but I don't understand how it can be a storage error if I'm not able to store it in the first place. So confused! Please help!
Here's my code and the error I keep getting:
DECLARE
VARIABLE b_basic number
VARIABLE b_pf number
today DATE:=SYSDATE;
tomorrow today%TYPE;
BEGIN
b_basic:=45;
b_pf:=12;
tomorrow:=today +1;
DBMS_OUTPUT.PUT_LINE(' Hello World ');
DBMS_OUTPUT.PUT_LINE('TODAY IS : '|| today);
DBMS_OUTPUT.PUT_LINE('TOMORROW IS : ' || tomorrow);
END;
ORA-06550: line 2, column 23: PLS-00103: Encountered the symbol "NUMBER" when expecting one of the following: := . ( @ % ; not null range default character
--------------------------------------------------------------------------------Don't mix SQL*Plus and PL/SQL syntax. In PL/SQL there is no VARIABLE keyword, just remove it.
See http://docs.oracle.com/cd/E11882_01/appdev.112/e25519/fundamentals.htm#LNPLS208.
With this:
set echo on
set serveroutput on
DECLARE
b_basic number;
b_pf number;
today DATE:=SYSDATE;
tomorrow today%TYPE;
BEGIN
b_basic:=45;
b_pf:=12;
tomorrow:=today +1;
DBMS_OUTPUT.PUT_LINE(' Hello World ');
DBMS_OUTPUT.PUT_LINE('TODAY IS : '|| today);
DBMS_OUTPUT.PUT_LINE('TOMORROW IS : ' || tomorrow);
END;
/you get with SQL*Plus command line:
SQL> set serveroutput on
SQL> --
SQL> DECLARE
2 b_basic number;
3 b_pf number;
4 today DATE:=SYSDATE;
5 tomorrow today%TYPE;
6 BEGIN
7 b_basic:=45;
8 b_pf:=12;
9 tomorrow:=today +1;
10 DBMS_OUTPUT.PUT_LINE(' Hello World ');
11 DBMS_OUTPUT.PUT_LINE('TODAY IS : '|| today);
12 DBMS_OUTPUT.PUT_LINE('TOMORROW IS : ' || tomorrow);
13 END;
14 /
Hello World
TODAY IS : 05-FEB-13
TOMORROW IS : 06-FEB-13
PL/SQL procedure successfully completed.Try to post APEX specific questions in APEX dedicated forum Oracle Application Express (APEX)
Edited by: P. Forstmann on 5 févr. 2013 13:38
Edited by: P. Forstmann on 5 févr. 2013 13:40 -
Hello I'm new to .net and I'm trying to work with bind variables
I keep getting the ORA-01036: illegal variable name/number error.
here's my code, can somebody help me out and show me what am I doing wrong?
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim drLocation As OracleDataReader = getSCLocation("SOMEBODY")
End Sub
Private Function getSCLocation(ByVal contactName As String) As OracleDataReader
Dim drLocation As OracleDataReader
Dim connString As String = ConfigurationManager.ConnectionStrings("scConnString").ConnectionString
Dim conn As New OracleConnection(connString)
conn.Open()
Dim queryString As String = "select a.location, a.location_name from locationm1 a where a.primary_contact_dept in (select b.dept from contactsm1 b where b.contact_name = p_contactName)"
Dim p_contactName As New OracleParameter
p_contactName.OracleType = OracleType.VarChar
p_contactName.Value = contactName
Dim cmdLocation As New OracleCommand(queryString, conn)
cmdLocation.Parameters.Add(p_contactName)
drLocation = cmdLocation.ExecuteReader(CommandBehavior.CloseConnection)
Return drLocation
End Function
Thanks
Peternever mind i got it by playing around with it
had to change the way to start the bind variable
Dim p_contactName As New OracleParameter("p_contactName", OracleType.VarChar)
p_contactName.Size = 140
p_contactName.Value = contactName -
HELP: VO Bind variable gets lost, VO passivation checked!
JDEv 10.1.3.0.4 + Struts/ADF
I have a VO with one bind variable "accountId", this VO is the "root master" of the hierarchy => not a detail of a link.
I added a method in the VO (that is part of one AM only) to set the bind variable:
WHERE CLAUSE:
(Wevent.EVENT_ID = WeventDesign.EVENT_ID) AND (Wevent.ACCOUNT_ID = AccountOwner.ACCOUNT_ID) AND (Wevent.PHOTOGRAPHER_ACCOUNT_ID = AccountPhotoGrapher.ACCOUNT_ID) AND (Wevent.EVENT_STATUS BETWEEN 30 AND 80) AND (Wevent.ACCOUNT_ID = :0)
Binding Style: Oracle Positional
private Number accountId = null;
private Object[] DEFAULT_VALUES = new Object[]{ Constants.NUMBER_ZERO };
private static int NUM_DEFAULT_VALUES = DEFAULT_VALUES.length;
public Row setAccountId(Number newAccountId)
Row row = null;
if (newAccountId == null)
this.accountId = null;
this.clearCache();
System.out.println(getClass().getName()+".setAccountId no exeqry newAccountId == null");
else
this.accountId = newAccountId;
row = this.getCurrentRow();
if(row == null || row.getAttribute("AccountId") == null || !newAccountId.equals(row.getAttribute("AccountId")))
// not good account events !!!!
this.setWhereClauseParam(0,newAccountId);
System.out.println(getClass().getName()+".setAccountId before exeqry newAccountId: "+newAccountId);
this.executeQuery();
// System.out.println(getClass().getName()+".setAccountId after exeqry getRowCount(): "+this.getRowCount());
row = this.first();
if (row != null)
System.out.println(getClass().getName()+".setAccountId after exeqry+first row.getAttribute(AccountId): "+row.getAttribute("AccountId"));
else
System.out.println(getClass().getName()+".setAccountId after exeqry+first row is null => no rows");
else
System.out.println(getClass().getName()+".setAccountId NO exeqry this.accountId: "+this.accountId+", newAccountId: "+newAccountId+" current is null? "+(this.getCurrentRow() == null));
this.accountId = newAccountId;
DEFAULT_VALUES[0] = newAccountId;
System.out.println(getClass().getName()+".setAccountId this.accountId: "+this.accountId+", newAccountId: "+newAccountId+", DEFAULT_VALUES[0]: "+DEFAULT_VALUES[0]);
return row;
In the AMImpl class I added a service method:
public Row prepareModelForEventAccountOwnerList(Number accountId)
EventAccountOwnerListExtVOImpl eventAccountOwnerListExtVOImpl = this.getEventAccountOwnerListExtVO1();
return eventAccountOwnerListExtVOImpl.setAccountId(accountId);
}When the user logs in his accountId is retrieved and stored in the HttpSession.
and the service method is called.
Ok at this point.
I have a Page that displays the view.
In the class AccountEventsAction that extends PagingDataForwardAction I have following initializeModelForPage method.
protected void initializeModelForPage(DataActionContext ctx)
System.out.println(getClass().getName()+".initializeModelForPage BEGIN "+System.currentTimeMillis());
WebAccountAM webAccountAM = (WebAccountAM) this.getApplicationModule(WebConstants.AM_WEBACCOUNT,ctx);
if (webAccountAM == null)
// return error
System.out.println(getClass().getName()+".initializeModelForPage webAccountAM not found.");
else
UserContainer userContainer = this.getUserContainer(ctx);
Row row = webAccountAM.prepareModelForEventAccountOwnerList(userContainer.getAccountId());
if (row != null)
System.out.println(getClass().getName()+".initializeModelForPage userContainer.getAccountId(): "+userContainer.getAccountId()+", EventId: "+row.getAttribute("EventId")+", current row key: "+row.getKey());
else
System.out.println(getClass().getName()+".initializeModelForPage userContainer.getAccountId(): "+userContainer.getAccountId()+", First row is null? "+(row == null));
super.initializeModelForPage(ctx);
}To my knowledge because this page is accessible only after login and the VO passivation state (+bind vars ..) is yes it shouldn't be necessary?
FIRST PROBLEM:(non blocking)
=============
I noticed in my trace that the VO current row is null when the service method gets called in the initializeModelForPage binding method?
So the query gets re-exceuted, is this normal??
SECOND PROBLEM (blocking)
================
At some point the Web app. the frameworks calls the executeQueryForCollection and an exception is thrown as if the bind variable was lost???
extract:
oracle.jbo.JboException: JBO-29000: Unexpected exception caught: oracle.jbo.SQLStmtException, msg=JBO-27122: SQL error during statement preparation. Statement: SELECT Wevent.EVENT_ID, ...
FROM WEVENT Wevent, WEVENT_DESIGN WeventDesign, ACCOUNT AccountOwner, ACCOUNT AccountPhotoGrapher WHERE (Wevent.EVENT_ID = WeventDesign.EVENT_ID) AND (Wevent.ACCOUNT_ID = AccountOwner.ACCOUNT_ID) AND (Wevent.PHOTOGRAPHER_ACCOUNT_ID = AccountPhotoGrapher.ACCOUNT_ID) AND (Wevent.EVENT_STATUS BETWEEN 30 AND 80) AND (Wevent.ACCOUNT_ID = :0) ORDER BY Wevent.T_MODIFIED
at oracle.jbo.JboException.<init>(JboException.java:346)
at oracle.adf.controller.lifecycle.PageLifecycle.handleError(PageLifecycle.java:722)
at oracle.adf.controller.struts.actions.DataAction.handleError(DataAction.java:257)
at oracle.adf.controller.struts.actions.DataAction.handleError(DataAction.java:453)
at oracle.adf.controller.lifecycle.PageLifecycle.handleLifecycle(PageLifecycle.java:147)
at oracle.adf.controller.struts.actions.DataAction.handleLifecycle(DataAction.java:223)
at com.photoswing.webview.actions.BaseDataForwardAction.handleLifecycle(BaseDataForwardAction.java:239)
at oracle.adf.controller.struts.actions.DataAction.execute(DataAction.java:155)
at oracle.adf.controller.v2.struts.actions.DataAction.execute(DataAction.java:104)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:434)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)
at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:332)
at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15)
at com.photoswing.filter.LocaleFilter.doFilter(LocaleFilter.java:318)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:627)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:376)
at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:870)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:451)
at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:218)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:119)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
at java.lang.Thread.run(Thread.java:595)
## Detail 0 ##
oracle.jbo.SQLStmtException: JBO-27122: SQL error during statement preparation.
06/10/13 22:37:15 java.sql.SQLException: Missing IN or OUT parameter at index:: 1
06/10/13 22:37:15 at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:138)I hope I didn't miss something and I don't have to review all my bind variables setting methods!
Your help is required and will be appreciated
FredMore info:
I added a trace in the executeQueryForCollection method of the VO.
As I said before the binding var is set on login and in initializeModelForPage
but when the executeQueryForCollection is called by framework later on in the action cycle, it is called without any parameters => bind variables = numUserParams: 0 ??
trace extract
com.photoswing.model.site.EventAccountOwnerListExtVOImpl.executeQueryForCollection this.accountId: null, numUserParams: 0, DEFAULT_VALUES[0]: 0
I suppose that some code must be added so that my bind variables will be part of the passivation process.
Can you help me with that?
Thanks for your time.
Fred
PS It's my second day on this problem. -
Need help in Bind variable in AF Query LOV
Hi,
i have one problem with bind variable, if i use bind variable in the LOV VO Query then my result is not coming, if there is not bind variable it's working fine and if i use the bind variable in the LOV search option then it's working fine but if i hide the bind variable and set the value in AM prepareSesstion method the LOV is not returning any value. I try to return the values also all values are also coming but those values are not setting to AF Query Attribute.
Query is:
select substr(d.description,0,40) description
from cm_system_users a,
cm_user_responsibilities b,
cm_responsibility_processes c,
cm_processes d
where a.nt_login =:B_NT_LOGIN
and a.user_id = b.user_id
and trunc(sysdate) between b.eff_date and nvl(b.exp_date,sysdate + 1)
and b.RESPONSIBILITY_ID = c.RESPONSIBILITY_ID
and c.process_type = d.process_type
and d.enabled_flag = 'Y' order by d.arguments_flag
AM Method:
CmProcessViewImpl vo = getCmProcessView();
String nt_login = getUserPrincipalName();
vo.setNamedWhereClauseParam("B_NT_LOGIN", nt_login.toUpperCase());
vo.executeQuery();
Can any one help me in this. it's urgent for me.This is a little underdescribed. IIUC, the view object in question is being used as a target for a view accessor, correct? (Otherwise you'll have to be more explicit about what you mean by "Query LOV".
If I'm right, there are two possibilities:
1) You are using a VO instance in a shared application module instance. If so, make sure your code is in the prepareSession() for that application module class if it's session dependent (as it seems to be below), you need to make sure the application module instance is shared at session scope.
2) You've based the view accessor directly on the VO definition. This basically creates an anonymous VO instance; I don't think there's any way to use prepareSession() to set a bind variable on such an instance (which won't be created until the accessor is first used). You might be able to get by with putting similar code into the view object class' create() method, but I haven't tested this.
If your code is in your primary application module class (as opposed to the class for a shared AM instance), the problem here is that getCmProcessView() returns the VO instance from that application module instance's design-time data model, which is never used by view accessors.
By the way, why do you need to do this in prepareSession() instead of at the view accessor level? I believe you can get the logged in user name (for the view accessor) in with the groovy expression
viewObject.DBTransaction.session.userPrincipalName
or possibly just
DBTransaction.session.userPrincipalName
(despite this involving DBTransaction, it returns the web app user name, not the DB username).
That's a 100% declarative solution, if you don't count the Groovy expression as non-declarative.
If you're afraid of a user executing the LOV (somehow) before the bind variable value gets set, just ensure that the bind variable is marked "required". -
[Oracle 8i] Need help with bind variable in add_months function
I'm trying to put a variable within my add_months function:
AND t1.edatetime >= add_months(sysdate,:v1)
AND t1.edatetime <= add_months(sysdate,:v2)I have tried defining the variable both as 'integer' type and 'numeric' type, but in both cases, my query returns no results. If I hard code the values, it works just fine.
Any suggestions?Hi,
Sorry, I can't reproduce the problem.
What do you mean by "I have tried defining the variable both as 'integer' type and 'numeric' type"?
Like Max said, you should post a complete script that gets the incorrect results.
Include your CREATE TABLE and INSERT statements, or use tables that are commonly available.
For example:
VARIABLE v1 NUMBER
VARIABLE v2 NUMBER
EXEC :v1 := -28 * 12;
EXEC :v2 := -27 * 12;
PROMPT ===== Checking values of bind variables =====
SELECT :v1
, :v2
FROM dual;
PROMPT ===== Main query (expecting 1 row of output) =====
SELECT ename
, hiredate
FROM scott.emp
WHERE hiredate >= ADD_MONTHS (SYSDATE, :v1)
AND hiredate <= ADD_MONTHS (SYSDATE, :v2)
;Output:
PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
===== Checking values of bind variables =====
:V1 :V2
-336 -324
===== Main query (expecting 1 row of output) =====
ENAME HIREDATE
MILLER 23-Jan-1982 -
Please help with integer variable matching frame numbers
hi :-) , could someone please hepl a newbie ?
I am trying to write a short AS3 script in CS4 that allows me to step backwards and forwards through an animation.
I have a stop button a play button , rewind button and a forward button.
the buttons work ok apart from when I hit the rewind button sometimes it jumps to the start of the timeline rather than just step back a frame at a time.
when I use the stop button and the timeline stops where it is, the rewind button steps back as required. but, if the rewind button is clicked first it jumps to the start of the timeline, I know the theory as to why I cant get this to work. I need to know how to increment an integer variable (counter) to increment as the animation playes. i.e. the counter variable to match the frame number. below is the code I have, could someone please tell me how to match an integer variable to the current frame and tell me where to insert the line of code on the listing. I have added a dummy line or psuedo line of code to show what I am trying to do, but the syntax is wrong .
var counter = 1;
gotoAndStop(counter);
function setupevents()
buttonplay.addEventListener(MouseEvent.CLICK, playbutton);
buttonstop.addEventListener(MouseEvent.CLICK, stopbutton);
buttonrewind.addEventListener(MouseEvent.CLICK, rewindbutton);
buttonforward.addEventListener(MouseEvent.CLICK, forwardbutton);
setupevents();
//this is the dummy or psuedo line of code i mentioned in the question above....
counter = frame;
//function to play the movie
function playbutton(event:MouseEvent)
play();
//function to stop the movie using the stop button
function stopbutton(event:MouseEvent)
stop();
//function to step backwards through movie using the rewind button
function rewindbutton(event:MouseEvent)
if(counter > 1)
counter = counter - 1
gotoAndStop(counter);
//function to step forward through movie using the forward button. I have used the value of 60 as this is the amount of frames in the timeline
//I dont know if this is correct way to do things or not
function forwardbutton(event:MouseEvent)
if(counter < 60)
counter = counter + 1
gotoAndStop(counter);
I know the code is rough and basic but any help would be greatly appreciated, I have tried to attach the .fla file for anyone who needs more info on this. But this webpage returned an error "The content type of this attachment is not allowed."
Auldy66var counter = 1;
gotoAndStop(counter);
function setupevents()
buttonplay.addEventListener(MouseEvent.CLICK, playbutton);
buttonstop.addEventListener(MouseEvent.CLICK, stopbutton);
buttonrewind.addEventListener(MouseEvent.CLICK, rewindbutton);
buttonforward.addEventListener(MouseEvent.CLICK, forwardbutton);
setupevents();
//this is the dummy or psuedo line of code i mentioned in the question above....
counter = frame;
//function to play the movie
function playbutton(event:MouseEvent)
play();
//function to stop the movie using the stop button
function stopbutton(event:MouseEvent)
stop();
//function to step backwards through movie using the rewind button
function rewindbutton(event:MouseEvent)
prevFrame();
function forwardbutton(event:MouseEvent)
nextFrame(); -
Please help with Load Variables / ASP
Hello,
I am using Load Variables to retreive a variable from an ASP
page, (which uses a response.write) to output the variable
getfile.onRelease = function()
myData = new LoadVars();
myData.onLoad = function(success){
if(success) {
getfile_txt.text = this.strString;
} else {
getfile_txt.text = "error";
myData.load("sendFile.asp");
stop();
the problem is that the output says "undefined", but when I
access the .asp page through my web browser I get the expected
result of the variable which is "Test1.Doc"
if any1 can help with this, i would be massivley thankful,
thanks.p.s strString is the variable that I am trying to pass from
the ASP page. -
Please help!! Variable convertion problem
Hi everyone.
I need your help. I am not very good with java and cannot do one thing:
When trying to make int from long, I get an error: "long cannot be dereferenced". This also happens when trying to move from int to long, double to float, etc.
I use this code:
int var1 = (int) longvariable;
or
int var1 = longvariable.intValue();
Nothing helps...
Thanks in advance for your help.
Alexander."long cannot be dereferenced"
int var1 = longvariable.intValue();this is normal. longvariable is not a reference type but a number.
A number has no methods, only an object can have member functions.
You should use Long instead of long, because Long extends Object,
and has some handy methods implemented
Like this:
Long myLong = new Long(longvariable);
int var1 = myLong.intValue();
Or like this (shorter but uses the same heap size):
int var1 = new Long(longvariable).intValue(); -
White spaces in bind variables
While calling a Report(based on sql with a bind variable) from a Form and passing a value with white space to the bind variable gives the following error:-
Error: An unexpected error occurred: ORA-06502: PL/SQL: numeric or value error (WWV-16016)
Also, attempting to translate white spaces is not helpful for bind variable.
Any help would be appreciated.
Thanks,
Gopi.Thanks for you replay Reddi,
Let me explain the scenario: The scenario is RFC --> XI --> JDBC, one of the element of the FM sometimes could be have the value " ", when this occurrs in the SXMB_MONI TC I see the value null in the element, that is the tag is <Element />, in this case I need to preserve this white space in the element. The message could be something like this:
<root>
<element1>value 1</element1>
<element2>value 2</element2>
<element3> </element3>
</root>
but I see the message in this form:
<root>
<element1>value 1</element1>
<element2>value 2</element2>
<element3 />
</root>
In the message mapping tool I assign the string value " " and the problem still the same.
Any Idea? -
Bind variable not declared - please help
Hello,
I have wrote a PL/SQL script to update some order_id's in a table. I have declared all my variables but get an error -- bind variable not declared. Can anyone tell me what the problem might be?
DECLARE
last_ship DATE ;
last_order NUMBER;
last_cust NUMBER;
VARIABLE curr_item NUMBER;
VARIABLE curr_order NUMBER;
aorder_id CHAR(6);
aitem_id CHAR(2);
acust_id NUMBER(6);
aship_date DATE;
CURSOR c1 IS
SELECT
order_id,
item_id,
ship_date,
cust_id
FROM
test_sales
ORDER BY
1,2,3,4,5;
BEGIN
SELECT
MAX(order_id)
INTO
curr_order
FROM
sales_order;
OPEN c1;
LOOP
FETCH c1 INTO aorder_id, aitem_id, aship_date, acust_id;
EXIT WHEN c1%NOTFOUND;
last_cust := c1.cust_id; -- Saves the last values to check if processing same order
last_order := c1.aorder_id; --
last_ship := c1.aship_date; --
IF c1.aorder_id = last_order AND c1.cust_id = last_cust AND c1.ship_date = last_ship THEN
curr_item := curr_item +1;
UPDATE test_sales SET c1.aorder_id = :curr_order;
UPDATE test_sales SET c1.aitem_id = :curr_item;
ELSE
curr_order := curr_order + 1;
curr_item := 1;
UPDATE test_sales SET c1.aorder_id = :curr_order;
UPDATE test_sales SET c1.aitem_id = :curr_item;
END IF;
END LOOP;
CLOSE c1;
END;
/Cheers
Mikecheck yours code you are direct accesing cusrsor named directly which is not allowed
1 DECLARE
2 vemp emp.empno%TYPE;
3 vemp1 emp.empno%TYPE;
4 CURSOR c1 IS SELECT empno FROM emp;
5 BEGIN
6 OPEN c1;
7 LOOP
8 FETCH c1 INTO vemp;
9 EXIT WHEN c1%NOTFOUND;
10 vemp1:=c1.empno;
11 END LOOP;
12 CLOSE c1;
13* END;
SQL> /
vemp1:=c1.empno;
ERROR at line 10:
ORA-06550: line 10, column 14:
PLS-00225: subprogram or cursor 'C1' reference is out of scope
ORA-06550: line 10, column 4:
PL/SQL: Statement ignored
SQL> DECLARE
2 vemp emp.empno%TYPE;
3 CURSOR c1 IS SELECT empno FROM emp;
4 BEGIN
5 OPEN c1;
6 LOOP
7 FETCH c1 INTO vemp;
8 EXIT WHEN c1%NOTFOUND;
9 END LOOP;
10 CLOSE c1;
11 END;
12 .
SQL> /
PL/SQL procedure successfully completed.Yours code
OPEN c1;
LOOP
FETCH c1 INTO aorder_id, aitem_id, aship_date, acust_id;
EXIT WHEN c1%NOTFOUND;
last_cust:= c1.cust_id;
last_order:= c1.aorder_id;
END LOOP;
CLOSE c1;
END;You sholud move it c1.cust_id within fetch statment or
bind the cursor name with another local cursor variable
then fetch into this local bind variable and use cursor
via this variable
e.g
DECLARE
CUSRSOR c1 IS SELECT cust_id,aorderid
FROM <TABLE>;
c2 c1%ROWTYPE;
OPEN c1;
LOOP
FETCH c1 INTO c2;
aorder_id:=c2.aorderid;
last_cust:= c1.cust_id;
last_order:= c1.aorder_id;
END LOOP;
CLOSE c1;
END;Khurram -
SP2-0552: Bind variable not declared error. Any help please?
Hi Experts,
I have a question regarding the error that I am getting: SP2-0552: Bind variable "V_COUNT_TOT_BAL" not declared.
I have 'out' parameters declared in my procedure and executing the same from sql script as shown below:
set ver off
set serverout on
set linesize 8000
Declare
Variable v_count_dtl_bal NUMBER(10);
Variable v_updat_dtl_bal NUMBER(10);
Variable v_count_tot_bal NUMBER(10);
Begin
execute load_abc.insert_abc_bal(:v_count_dtl_bal,:v_updat_dtl_bal,:v_count_tot_bal);
End;
exit;
So, when this sql script runs it given me the above error. However, all the result looks good and there's no problem with the data or anything else that might be impacted. I suspect this error stems from the code in the sql script above.
Any idea what am I doing wrong?
Thanks in advance for any inputs.Thanks Frank. I still receive the same error if I follow your example or any of the ones explained above. This is what I am getting and still an error underneath:
Usage: VAR[IABLE] [ <variable> [ NUMBER | CHAR | CHAR (n [CHAR|BYTE]) |
VARCHAR2 (n CHAR) | NCHAR | NCHAR (n) |
NVARCHAR2 (n) | CLOB | NCLOB | REFCURSOR |
BINARY_FLOAT | BINARY_DOUBLE ] ]
Usage: VAR[IABLE] [ <variable> [ NUMBER | CHAR | CHAR (n [CHAR|BYTE]) |
VARCHAR2 (n CHAR) | NCHAR | NCHAR (n) |
NVARCHAR2 (n) | CLOB | NCLOB | REFCURSOR |
BINARY_FLOAT | BINARY_DOUBLE ] ]
Usage: VAR[IABLE] [ <variable> [ NUMBER | CHAR | CHAR (n [CHAR|BYTE]) |
VARCHAR2 (n CHAR) | NCHAR | NCHAR (n) |
NVARCHAR2 (n) | CLOB | NCLOB | REFCURSOR |
BINARY_FLOAT | BINARY_DOUBLE ] ]
SP2-0552: Bind variable "V_COUNT_TOT_BAL" not declared. -
Help need in Binding variable with ViewObject
hi All,
iam very new to Oracle ADF . Iam using Jdeveloper 11.1.1.3.0 for developing ADF Application.
i have created a view object with binding variable "emp_name".
query :: select * from emp_adf where name:=emp_name
i need to get this value from my page(jspx).
please help me how to proceed further.
My requriement:
page should have one text filed and after submitting the value it should query the DB and result should come.
If any one gives little demo or article for this ,it will be really helpful for me.
Regards,
Suresh kumar.I think below links would be useful for you.
http://download.oracle.com/docs/cd/E15523_01/web.1111/b31974/bcquerying.htm#CEGDGIJH
http://jobinesh.blogspot.com/2010/10/how-to-set-bind-variable-values-at.html
~Abhijit -
HELP: Bind Variable does't work in SQL statement
I am trying to connect a text item bind variable into the where
clause of an SQL statement. Specifically into an INSERT
statement and SELECT statement. It gives me an message box
error, saying it is unable to insert. There is no Oracle error
number associated with it. Is this a bug? Has this happened to
anyone else. PLEASE HELP! URGENT!
nullI assume this is a forms problem. You need to check out the
dbms_error_code and dbms_error_text to get your oracle error.
You can trap and report these types of errors using an on-error
trigger. Also, if you are using the default menu then check
out help -> display error immediately after the form reports
unable to insert ...... This should give you enough information
to solve your problem, or at least point you in the right
direction.
Daniel Jensen (guest) wrote:
: I am trying to connect a text item bind variable into the where
: clause of an SQL statement. Specifically into an INSERT
: statement and SELECT statement. It gives me an message box
: error, saying it is unable to insert. There is no Oracle error
: number associated with it. Is this a bug? Has this happened to
: anyone else. PLEASE HELP! URGENT!
null
Maybe you are looking for
-
Hi, I've got an Ipad retina i've had it over 2 years now, but it is still immaculate so I really don't want to have to get a new one. We've been to three the other day (contract with three) they have given us a new sim card to try but it hasn't worke
-
Web service client JAR problem
I have a .NET Web Service and I made a client JAR with the WebLogic Workshop. When I try to have data from the Web Service the WebLogic console shows me this error web service invoke failed: javax.xml.soap.SOAPException: failed to serialize interface
-
Portlet - Requested Resource is Not Available?
Hey, I'm creating a portlet in jetspeed, and I am hitting a bit of a snag which I don't understand. When I try to load up the portlet in question, I get the message: The requested resource (/container) is not available I am totally stuck. I am 99% su
-
I want the code to send a mail with attachment
can u please help me?
-
How to check the previous loaded SAP GUI patch number
Hi now I am installing patch#24 SAP GUI ,now where to check the previous added patches,where I need to check, please mail the path