Home » Developer & Programmer » Forms » CheckBox
CheckBox [message #619211] Sat, 19 July 2014 15:28 Go to next message
jsanquintin
Messages: 20
Registered: July 2014
Location: Santo Domingo Republica D...
Junior Member
I have a dynamic condition where the cursor within a cursor receives some parameters checkbox.

the problem is that when the cursor plus a receive parameter data does not bring me.

any suggestions ???


Juan Sanquintin
Dominican Republic.
Re: CheckBox [message #619212 is a reply to message #619211] Sat, 19 July 2014 15:36 Go to previous messageGo to next message
Littlefoot
Messages: 21809
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I'm afraid I don't understand the question.

What is "cursor within a cursor"? Nested cursor loops?

Where does the parameter come from?

Could you post code you wrote (if it is too complex, create a simplified version, possibly based on Scott's schema as we all have it). In order to make your code readable, please, format it and enclose into [code] tags (here's how). Also, a screenshot might help us understand what you have (and what you'd want to do).
Re: CheckBox [message #619320 is a reply to message #619212] Mon, 21 July 2014 08:16 Go to previous messageGo to next message
jsanquintin
Messages: 20
Registered: July 2014
Location: Santo Domingo Republica D...
Junior Member
PROCEDURE PRC_RESULTADO(pMARCA VARCHAR2) IS

CURSOR cRESULTADO IS
SELECT NVL(ESTATUS,'SIN_ESTADO')ESTADO,
COUNT(*)CANTIDAD
FROM TABLE_NAME
WHERE FIELD IN (pMARCA)
GROUP BY ESTATUS;
--

BEGIN
GO_BLOCK('CINCO');
CLEAR_BLOCK;
FOR RG IN cRESULTADO
LOOP
:CINCO.ESTATUS := RG.ESTADO ;
:CINCO.CANT := RG.CANTIDAD;
CREATE_RECORD;
END LOOP;
FIRST_RECORD;
GO_BLOCK('CINCO');
END;

I have this procedure that fills the block on this if you look where you step Littlefoot and a parameter when it receives more than one data does not bring it to me.

That's my point as I do that I get more than one value within the IN in the where condition.

--
and this below is in charge of taking the value of the checkbox corresponding to concatenate collate and pass it to another procedure.

I hope you understand me so they can help me.

PROCEDURE PRC_TRAE_IND IS
MARCA VARCHAR2(500);
vMARCA VARCHAR2(500);
vCHAR VARCHAR2(10) := CHR(39);
pMARCA VARCHAR2(10);


BEGIN
GO_BLOCK('DOS');
FIRST_RECORD;
LOOP
IF CHECKBOX_CHECKED('IND_MARCA') THEN
MARCA := MARCA || vCHAR || :DOS.CODIGO ||vCHAR||',';
END IF;
EXIT WHEN :SYSTEM.LAST_RECORD = 'TRUE';
NEXT_RECORD;
END LOOP;
FIRST_RECORD;
MARCA := SUBSTR(MARCA,1,LENGTH(MARCA)-1);

BEGIN
PRC_RESULTADO(MARCA);
END;

END;

Re: CheckBox [message #619322 is a reply to message #619320] Mon, 21 July 2014 08:22 Go to previous messageGo to next message
cookiemonster
Messages: 13923
Registered: September 2008
Location: Rainy Manchester
Senior Member
Please read and follow How to use [code] tags and make your code easier to read?

You're suffering from the varying in-list problem. A string containing commas is not the same thing as a comma seperated list in an IN clause.
Read this: varying in list
Re: CheckBox [message #619324 is a reply to message #619322] Mon, 21 July 2014 08:42 Go to previous messageGo to next message
jsanquintin
Messages: 20
Registered: July 2014
Location: Santo Domingo Republica D...
Junior Member
mee apologize for uploading the code that way.!!!!

in the link you sent me is exactly what happens to me.

With that function I can solve my problem??
Re: CheckBox [message #619325 is a reply to message #619324] Mon, 21 July 2014 08:48 Go to previous messageGo to next message
cookiemonster
Messages: 13923
Registered: September 2008
Location: Rainy Manchester
Senior Member
That link shows multiple solutions, Use the 9i and above solution if your version of forms will allow it.
Re: CheckBox [message #619329 is a reply to message #619325] Mon, 21 July 2014 10:12 Go to previous messageGo to next message
jsanquintin
Messages: 20
Registered: July 2014
Location: Santo Domingo Republica D...
Junior Member
donot how to implement that in my code
Re: CheckBox [message #619340 is a reply to message #619329] Mon, 21 July 2014 13:43 Go to previous messageGo to next message
Littlefoot
Messages: 21809
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Here's one option. My P_TEST procedure is like your PRC_RESULTADO; it accepts a comma-separated values list (list of departments in Scott's DEPT table) and displays employees that work in those departments.
SQL> create or replace procedure p_test (par_depts in varchar2)
  2  is
  3    cursor cur_emp is
  4      select deptno, ename, job
  5      from emp
  6      where deptno in (select regexp_substr(par_depts, '[^,]+', 1, level)
  7                       from dual
  8                       connect by regexp_substr(par_depts, '[^,]+', 1, level) is not null
  9                      )
 10      order by deptno, ename;
 11  begin
 12    for cur_r in cur_emp loop
 13      dbms_output.put_line(cur_r.deptno ||': '|| cur_r.ename ||', '|| cur_r.job);
 14    end loop;
 15  end;
 16  /

Procedure created.

SQL>

Lines 6 - 9 are used to convert columns to rows.

For example:
SQL> with test as (select '10,30,3' col from dual)
  2  select regexp_substr(col, '[^,]+', 1, level)
  3  from test
  4  connect by regexp_substr(col, '[^,]+', 1, level) is not null;

REGEXP_
-------
10
30
3

SQL>
See?
10,30,3 --> 10
            30
            3
OK, let's invoke the procedure:
SQL> declare
  2    l_depts varchar2(20) := '10,30';
  3  begin
  4    p_test (l_depts);
  5  end;
  6  /
10: CLARK, MANAGER
10: KING, PRESIDENT
10: MILLER, CLERK
30: ALLEN, SALESMAN
30: BLAKE, MANAGER
30: JAMES, CLERK
30: MARTIN, SALESMAN
30: TURNER, SALESMAN
30: WARD, SALESMAN

PL/SQL procedure successfully completed.

SQL>


Review that code and adjust it so that fulfills your needs. I hope you'll make it work. If not, post what you've tried (don't forget to properly format code and maintain formatting using the [code] tags), say what went wrong and someone will assist.
Re: CheckBox [message #619569 is a reply to message #619340] Wed, 23 July 2014 07:38 Go to previous message
jsanquintin
Messages: 20
Registered: July 2014
Location: Santo Domingo Republica D...
Junior Member
Littlefoot, thank you very much, everything worked perfectly. and to everyone who helped me also thank you
Previous Topic: How to definne? - it is first or second start of the trigger "WHEN-VALIDATE-ITEM"
Next Topic: Query find form
Goto Forum:
  


Current Time: Sat May 18 10:32:58 CDT 2024