Home » Developer & Programmer » Forms » Global variable (Oracle 10.2.0.1.0,forms 10g)
Global variable [message #588707] Thu, 27 June 2013 10:14 Go to next message
jay_cooldude
Messages: 50
Registered: March 2013
Location: Hyd
Member
Hi Sir,

I have a problem using global variables.

I have created two fmb files

1)LOGIN.fmb

2)EMP_CONNECT.fmb

In login.fmb file i have created a login page using emp table and global variables (:global.u,:global.p).
my table structure and data is
SQL> desc emp
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------

 EMPNO                                     NOT NULL NUMBER(4)
 ENAME                                              VARCHAR2(10)
 JOB                                                VARCHAR2(9)
 MGR                                                NUMBER(4)
 HIREDATE                                           DATE
 SAL                                                NUMBER(7,2)
 COMM                                               NUMBER(7,2)
 DEPTNO                                             NUMBER(2)

SQL> select * from emp;

     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


     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM
---------- ---------- --------- ---------- --------- ---------- ----------
    DEPTNO
----------
      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       2450
        10


     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM
---------- ---------- --------- ---------- --------- ---------- ----------
    DEPTNO
----------
      7788 SCOTT      ANALYST         7566 09-DEC-82       3000
        20

      7839 KING       PRESIDENT            17-NOV-81       5000
        10

      7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0
        30


     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM
---------- ---------- --------- ---------- --------- ---------- ----------
    DEPTNO
----------
      7876 ADAMS      CLERK           7788 12-JAN-83       1100
        20

      7900 JAMES      CLERK           7698 03-DEC-81        950
        30

      7902 FORD       ANALYST         7566 03-DEC-81       3000
        20


     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM
---------- ---------- --------- ---------- --------- ---------- ----------
    DEPTNO
----------
      7934 MILLER     CLERK           7782 23-JAN-82       1300
        10

      7566 JONES      MANAGER         7839 02-APR-81       2975
        20


14 rows selected.

and i have used used empno as user id and assigned it to
:global.u ,ename as password and assigned it to
:global.p
.
In a new_form i called a new emp_connect.fmx file
in that data block
i gave target data source type as :from query clause
source as (select * from emp start with empno=:global.u connect by prior empno=mgr order by deptno,level)
and created items and canvas.

I executed the form login.fmb and opened the form emp_connect.fmb

but when i tried to execute the form using [cntrl+F11].

it throws an error FRM-40505: ORACLE ERROR: unable to perform query.

but if i use the following query in from clause query of emp_connect's data block, then it works fine
(select * from emp start with empno=7566 connect by prior empno=mgr order by deptno,level)

please find the login .fmb file in the attachment . i will sent emp_connect.fmb file in next message.

Thanks In advance.

Regards,

Jay.


[MERGED by LF]
  • Attachment: LOGIN.fmb
    (Size: 52.00KB, Downloaded 35 times)

[Updated on: Thu, 27 June 2013 10:25] by Moderator

Report message to a moderator

global variable part2(With reference to global variable part1) [message #588708 is a reply to message #588707] Thu, 27 June 2013 10:18 Go to previous messageGo to next message
jay_cooldude
Messages: 50
Registered: March 2013
Location: Hyd
Member
Hi Sir,

With reference to global variable part1
i am attaching the second fmb file.

Thanks in Advance.

Regards,

Jay
  • Attachment: LOGIN.fmb
    (Size: 52.00KB, Downloaded 31 times)
Re: global variable part2(With reference to global variable part1) [message #588710 is a reply to message #588708] Thu, 27 June 2013 10:31 Go to previous messageGo to next message
cookiemonster
Messages: 10929
Registered: September 2008
Location: Rainy Manchester
Senior Member
Use help -> display error from the runtime menus when you get the error to see exactly why oracle can't execute the query.

I suspect you may need to create two datablock items in emp_connect assign the values of the globals to them in when-new-form-instance then use them instead of the globals in the query.
Re: global variable part2(With reference to global variable part1) [message #588806 is a reply to message #588710] Fri, 28 June 2013 09:25 Go to previous messageGo to next message
jay_cooldude
Messages: 50
Registered: March 2013
Location: Hyd
Member
Hi Sir,

I am not getting the desired result and the display error shows All Variables are not bound

Thanks & Regards,

Jay.
Re: global variable part2(With reference to global variable part1) [message #588811 is a reply to message #588710] Fri, 28 June 2013 09:44 Go to previous messageGo to next message
cookiemonster
Messages: 10929
Registered: September 2008
Location: Rainy Manchester
Senior Member
cookiemonster wrote on Thu, 27 June 2013 16:31

I suspect you may need to create two datablock items in emp_connect assign the values of the globals to them in when-new-form-instance then use them instead of the globals in the query.

Re: global variable part2(With reference to global variable part1) [message #588812 is a reply to message #588811] Fri, 28 June 2013 09:51 Go to previous messageGo to next message
jay_cooldude
Messages: 50
Registered: March 2013
Location: Hyd
Member
Hi Sir (cookiemonster),

i am happy that u suggested to take to non block items and use new instance query.
i would be more happy and thankful to you if you could send the code to assign the value of :global.u to a non database item in new form instance trigger. because I have already tried that too and got the same result.

Thanks & Regards,

Jay.

[Updated on: Fri, 28 June 2013 09:53]

Report message to a moderator

Re: global variable part2(With reference to global variable part1) [message #588813 is a reply to message #588812] Fri, 28 June 2013 10:02 Go to previous messageGo to next message
cookiemonster
Messages: 10929
Registered: September 2008
Location: Rainy Manchester
Senior Member
item := global

There's no special code for this.

Copy and paste the exact error message from display error when you try this.
Re: global variable part2(With reference to global variable part1) [message #588814 is a reply to message #588813] Fri, 28 June 2013 10:20 Go to previous messageGo to next message
jay_cooldude
Messages: 50
Registered: March 2013
Location: Hyd
Member
Hi Sir ,

Please find the attachment.

Thanks & Regards,

Jayanth.

./fa/10936/0/./fa/10936/0/
  • Attachment: Untitled.jpg
    (Size: 211.79KB, Downloaded 139 times)
Re: global variable part2(With reference to global variable part1) [message #588832 is a reply to message #588814] Fri, 28 June 2013 13:15 Go to previous message
joy_division
Messages: 4504
Registered: February 2005
Location: East Coast USA
Senior Member
It's quite obvious. Oracle does not know what ITEM24 is. Is it is column, a variable, a literal?

Use appropriate quotes, colon, or whatever depending on what it is.
Previous Topic: EXECUTE QUERY
Next Topic: Bad bind variable error
Goto Forum:
  


Current Time: Sat Aug 30 04:05:44 CDT 2014

Total time taken to generate the page: 0.10370 seconds