Home » Developer & Programmer » Forms » colander code not work (Oracle forms 6i)
colander code not work [message #547034] Sun, 11 March 2012 22:28 Go to next message
qaiserjavid
Messages: 25
Registered: May 2011
Location: Pakistan
Junior Member

Dear All,
i have colander code but it not work properly.please solve the problem.this code works in database but not work on forms.


SELECT INITCAP(TRIM(TO_CHAR(dat, 'month'))) || ', ' || TO_CHAR(SYSDATE, 'yyyy') MONTH,
MAX(DECODE(TO_CHAR(dat, 'd'), 2, TO_CHAR(dat, 'dd'))) mon,
MAX(DECODE(TO_CHAR(dat, 'd'), 3, TO_CHAR(dat, 'dd'))) tue,
MAX(DECODE(TO_CHAR(dat, 'd'), 4, TO_CHAR(dat, 'dd'))) wed,
MAX(DECODE(TO_CHAR(dat, 'd'), 5, TO_CHAR(dat, 'dd'))) thu,
MAX(DECODE(TO_CHAR(dat, 'd'), 6, TO_CHAR(dat, 'dd'))) fri,
MAX(DECODE(TO_CHAR(dat, 'd'), 7, TO_CHAR(dat, 'dd'))) sat,
MAX(DECODE(TO_CHAR(dat, 'd'), 1, TO_CHAR(dat, 'dd'))) sun
FROM
(SELECT TRUNC(SYSDATE, 'y') + ROWNUM -1 dat,
TO_CHAR(TRUNC(SYSDATE, 'y') + ROWNUM -1, 'iw') woy
FROM user_objects
WHERE ROWNUM <=(ADD_MONTHS(TRUNC(SYSDATE, 'y'), 12) -TRUNC(SYSDATE, 'y')))
GROUP BY TO_CHAR(dat, 'month'),
woy,
TO_CHAR(dat, 'mm')
ORDER BY TO_CHAR(dat, 'mm'),8;

Error is
identifir 'trim' must be declare

[Updated on: Sun, 11 March 2012 22:32]

Report message to a moderator

Re: colander code not work [message #547047 is a reply to message #547034] Mon, 12 March 2012 01:04 Go to previous messageGo to next message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Where did you put this code? If it is a trigger (or other PL/SQL unit), it requires an INTO clause.

P.S. Please, learn to format your code and use [CODE] tags to preserve formatting. Have a look here (it will take only a few seconds).

[Updated on: Mon, 12 March 2012 01:07]

Report message to a moderator

Re: colander code not work [message #547095 is a reply to message #547047] Mon, 12 March 2012 04:49 Go to previous messageGo to next message
cookiemonster
Messages: 13925
Registered: September 2008
Location: Rainy Manchester
Senior Member
Since you're using forms 6i you will probably need to create a view for the select statement and then query that in the form.
Re: colander code not work [message #547266 is a reply to message #547095] Tue, 13 March 2012 11:22 Go to previous messageGo to next message
owais_baba
Messages: 289
Registered: March 2008
Location: MUSCAT
Senior Member
mr @qaiserjavid why are taking this much tension for calendar if u simply wanted to attached calendar in your form then follown these steps and if really wanted to implemented your code which u have posted then follow @cookiemonster he right u need to create view.


1)Set the LOV of the item for which calendar to be attached as ENABLE_LIST_LAMP LOV, which is included in the TEMPLATE form.

2)Set ?Validate from List? to 'No' in the property palette of that item .

3)Then in KEY?LISTVAL trigger of that item write

calendar.show;

--- To add a calendar in Form 6i
You will need to files
1) stndrd.olb
2) calendar.pll
******************
1) From within forms open the file stndrd.olb via file>> open.(Search for stndrd.olb file in your hard disk).This will add the item "standards" to the object navigator/object libraries section. This will now always appear in the object navigator.

2) Next open the form that you wish the calendar to be on.

3) Expand the "library tabs" section of the "standards" item in "object libraries" to reveal 5 items, inc. "components". Right click on "components" & select "object libraries" from the menu that appears.

4) From the box that appears select the component "calendar" and drag it to the form you wish it to be added to within the "object navigator". It will then ask whether you want to "sub-class" or "copy". Select copy, or the form with the calendar will not work on PC's that does not have thestandards item added. Copying will add all required bits you need for the calendar.

5) Next open the "calendar.pll" file & this will add a "calendar" item to the "pl/sql libraries" section on the "object navigator". Select the "program unit" section and drag it up to the "programs unit" sectino of your form. This will add 2 items to the "programs unit" section (date_lov - package spec & date lov -package body).

6) Next on my form i added a button to call the calender with a "when_button_pressed" trigger & added this code.
********************************
     DATE_LOV.GET_DATE
    (NVL(:BLOCK.ITEM, SYSDATE),
    'BLOCK.ITEM',
     200, 100,
'SELECT DATE',
    'OK','CANCEL',
    TRUE, FALSE, FALSE);

********************************
The block.item is where you want the date to be inserted into via the calendar user interaction.



Thanks

[Updated on: Tue, 13 March 2012 11:24]

Report message to a moderator

Re: colander code not work [message #547274 is a reply to message #547266] Tue, 13 March 2012 11:36 Go to previous message
owais_baba
Messages: 289
Registered: March 2008
Location: MUSCAT
Senior Member
if u really dont have the idea of creating views i give u idea
 create or replace view emp_dept as
 select emp.empno,
        emp.ename,
        dept.deptno,
        dept.dname
  from  emp,
        dept 
        where
        emp.deptno=dept.deptno;


and how to insert/delete/update data into the view emp_dept using forms 6i?

You can insert/delete/update data in a view the same way you do with a table, but remember there are some restrictions when doing these operations on join views (for example: you cannot modify more than one base table, you cannot modify a column which maps to a non key-preserved table, you cannot delete from a view without exactly one key-preserved table, etc...).

You can create "instead of " triggers for the view and deal with all of the tables in the view.




best regards
Previous Topic: Updating BLOB Column
Next Topic: how to sum rows in forms 6i
Goto Forum:
  


Current Time: Fri Jul 05 22:59:35 CDT 2024