Count into variable not working in procedure
I'm writing a simple procedure in a package. Based on Record count I'm inserting record into other table.
count(fielname) alwways returns zero. But the same SQL statement works fine when I just execute sql statement out side of procedure in SQL window.
supplierid, userid fields are varchar(20)
L_CNTSUPP NUMBER;
SELECT count(SUPPLIERID)
INTO L_CNTSUPP
FROM TBLSEQUENCE TS, TBLUSER TU
WHERE ltrim(rtrim(TS.SUPPLIERID)) = ltrim(rtrim(TU.INFO_1))
AND ltrim(rtrim(TU.USERID)) = ltrim(rtrim(L_USERID));
DBMS_OUTPUT.put_line(L_CNTSUPP);
Please advice.
Hello,
Try this:
SELECT count(*)
INTO L_CNTSUPP
FROM TBLSEQUENCE TS, TBLUSER TU
WHERE ltrim(TS.SUPPLIERID) = ltrim(TU.INFO_1)
AND ltrim(TU.USERID) = ltrim(L_USERID);
DBMS_OUTPUT.put_line(L_CNTSUPP);A few points: you do not need an RTRIM when using VARCHAR since it's automatically RTRIMmed, but you should be using VARCHAR2 in Oracle - VARCHAR is for Oracle's own internal use and may change without notice. You only need LTRIM if you've spaces to the left of the data.
Similar Messages
-
Hi all,
I've been trying to use Profile Manager to specify user e-mail accounts on Mac devices (eg, MacBooks) but I've been encountering a couple of problems. I've tried searching around and didn't find any answers.
First of all I'm running the latest Mountain Lion Sever. All clients have up-to-date Mountain Lion too.
Problem 1: Payload variables not working
I'd like to automatically setup Gmails on the MacBooks. Now the users' email addresses are already set to their gmail accounts. So all I have to be able to do is use the %email% payload variable as the username when I go set up the (IMAP) mail accounts in the Profile Manager. However, when I download the profile to the device, it does not convert the payload variable; ie, it tries to log into gmail with the username '%email%'. Other payload variables do not work either.
Oddly enough, the payload variables work as they should with iOS devices...
Problem 2: Profiles stuck on 'Sending'
After enrolling the devices, it seems a hit and miss whether the MacBook downloads the correct profiles from the server... Is there a way to force on the MacBook to update/refresh its profiles? Also, when I update profiles within Profile Manager, the changes are pushed to iOS devices fine but not to MacBooks. Those tasks are all stuck on Sending... Logging in, restarting etc. sometimes helps but not always... Is there a reason why?
Thanks in advance.
P.S. Sorry I posted in the wrong forum first...Same problem here. Some profiles are being sent, some are stuck on the server. I have no idea why this difference.
Any luck solving the issue? -
Payload variables not working & Profiles stuck on 'Sending'
Hi all,
I've been trying to use Profile Manager to specify user e-mail accounts on Mac devices (eg, MacBooks) but I've been encountering a couple of problems. I've tried searching around and didn't find any answers.
First of all I'm running the latest Mountain Lion Sever. All clients have up-to-date Mountain Lion too.
Problem 1: Payload variables not working
I'd like to automatically setup Gmails on the MacBooks. Now the users' email addresses are already set to their gmail accounts. So all I have to be able to do is use the %email% payload variable as the username when I go set up the (IMAP) mail accounts in the Profile Manager. However, when I download the profile to the device, it does not convert the payload variable; ie, it tries to log into gmail with the username '%email%'. Other payload variables do not work either.
Oddly enough, the payload variables work as they should with iOS devices...
Problem 2: Profiles stuck on 'Sending'
After enrolling the devices, it seems a hit and miss whether the MacBook downloads the correct profiles from the server... Is there a way to force on the MacBook to update/refresh its profiles? Also, when I update profiles within Profile Manager, the changes are pushed to iOS devices fine but not to MacBooks. Those tasks are all stuck on Sending... Logging in, restarting etc. sometimes helps but not always... Is there a reason why?
Thanks in advance.Same problem here. Some profiles are being sent, some are stuck on the server. I have no idea why this difference.
Any luck solving the issue? -
this photo illustrate how that (Substitution Variables) not working in "SQL Developer" Environment :-
http://www.imagehosting.com/show.php/1555180_ddddd.PNG.html
any solve for this problem ?????!!!!!!!!!!There is a dedicated forum for SQL Developer related questions
SQL Developer
I should admit however, that query you have provided ( with substitution variables) works like a charme in my environment (SQL Developer 1.1.0.23 build 23.64)
Best regards
Maxim -
Update query not working thru procedure
Hi
I need to update one table column based on another table column.
thru sql statement it is working, but same statement is not working thru stored procedure.
update target_table a set a.col2 = (select col2 from source_table b where a.id = b.id);
Above statement is working thru sql statement ,but it is not working thru procedure.
So Please on this.
Regards,
Venkatpost the code for the procedure. Kindly use before and after the procedure statement!
-
Date type parameters do not work package procedure
a cordial greeting to the whole community, in advance thank you very much for your precious time
a general way I have the following, a package in which I have a main procedure which I recible three parameters: a start date, a final, and a number of client
to use the dates I enter as parameter to query yields no records, but if I assign the date internally in the procedure, if it sheds records, the strange thing is that both the data and the parameters that are identical internally assigned even in its length and I checked, the truth and I stay out of ideas thank you very much for your time attaching the code
for now I'm just using the second query forget the first
------call to procedure-----
DECLARE
errcode VARCHAR2(200);
errbuf VARCHAR2(200);
BEGIN
xxxxx.pkg.xxxinitial_end(errcode ,errbuf
,'2013/08/19 00:00:00'
,'2013/08/23 00:00:00','456456456546');
END;
-----------------------------------------------------------------procedure---------------------------------------------------------------------
PROCEDURExxxinitial_end (ERRCODE OUT VARCHAR2
, ERRBUFF OUT VARCHAR2
, p_initial_date IN VARCHAR2
, p_end_date IN VARCHAR2
, customer IN VARCHAR2)IS
l_encoding_line VARCHAR2(240);
cur_without_customer SYS_REFCURSOR;
cur_with_customer SYS_REFCURSOR;
initial_date DATE;
end_date DATE;
initial_date2 DATE;
end_date2 DATE;
BEGIN
l_encoding_line := '<?xml version="1.0" encoding=' || '"iso-8859-1"' ||
' ?>' || chr(10) || '<XXOCS_TOTAL_VENTAS_SINEXP>';
initial_date := to_date(p_initial_date, 'YYYY/MM/DD HH24:MI:SS');-----------------input parameters NOT WORKING
end_date := to_date(p_end_date, 'YYYY/MM/DD HH24:MI:SS');-------------------input parameters
initial_date2:=to_date('2013/08/19 00:00:00', 'YYYY/MM/DD HH24:MI:SS');---------------------default values
end_date2:=to_date('2013/08/23 00:00:00', 'YYYY/MM/DD HH24:MI:SS');---------------------default values WORKING FINE
IF customer IS NULL THEN
-- OPEN cur_without_customer;
DBMS_OUTPUT.PUT_LINE('se ejecuto el primero');
-------------------------cursor -----------------------------------
OPEN cur_without_customer FOR
SELECT rct.customer_trx_id
,rctl.customer_trx_line_id
,hp.party_name ---cliente
,hca.account_number ----N° Cliente
,rctl.line_number -----item
,rctt.name---descripcion transaccion
,rct.trx_number -----numero
,rctt.type ------tipo de transaccion
,hp.party_id--control solamente
,rct.trx_date------Fecha de emisión Comprobante de Venta
,rct.attribute1 ---No. de autorización del Comprobante de Venta
,mp.attribute9||rct.trx_number N_Comprobante---No. de Comprobante de Venta
,rct.attribute4-----Unidad Estratégica de Negocio
,mp.attribute9---- N° de establecimiento
,rctl.description-----Descripción (Tipo de Combustible)
,rctl.quantity_invoiced---Cantidad Vendida en galones
,rctl.unit_selling_price---Precio de venta unitario
--,rctl.taxable_amount-------Valor Base Imponible --restriccion
--,rctl.extended_amount---valor iva 12%
-- ,NVL(importe_12(rctl.customer_trx_line_id,rct.customer_trx_id),'N/A')
FROM ra_customer_trx_all rct,
ra_customer_trx_lines_all rctl,
hz_cust_accounts hca,
hz_parties hp,
ra_cust_trx_types_all rctt,
mtl_parameters mp
-- mtl_system_items_b msi,
-- zx_lines zl
--ra_batch_sources_all rbs
WHERE
--rct.trx_date BETWEEN initial_date AND end_date --parametros de fecha
rct.trx_date BETWEEN to_date('2013/08/19 00:00:00', 'YYYY/MM/DD HH24:MI:SS')/*initial_date*/ AND to_date('2013/08/23 00:00:00', 'YYYY/MM/DD HH24:MI:SS')/*end_date*/
AND rct.sold_to_customer_id = hca.cust_account_id
AND hca.party_id = hp.party_id
AND rct.customer_trx_id=rctl.customer_trx_id
--AND rctl.inventory_item_id=msi.inventory_item_id
AND mp.organization_id=rctl.warehouse_id
AND rct.cust_trx_type_id = rctt.cust_trx_type_id;
print_output(fnd_file.output, l_encoding_line);
get_xml(cur_without_customer, 'G_REGISTER', 'CABECERA', ERRCODE);
IF ERRCODE = 1 THEN
ERRBUFF := 'El reporte no arrojo datos para los parametros ingresados';
ERRCODE := 2;
RETURN;
ELSIF ERRCODE = 2 THEN
ERRBUFF := SQLERRM;
RETURN;
END IF;
print_output(fnd_file.output, '</XXOCS_TOTAL_VENTAS_SINEXP>');
ELSE
-- OPEN cur_with_customer;
DBMS_OUTPUT.PUT_LINE('se ejecuto el segundo');
-----------------------cursor 2---------------------------
DBMS_OUTPUT.PUT_LINE('customer ' || customer);
DBMS_OUTPUT.PUT_LINE('ASI ESTAN ENTRANDO LOS PARAMETROS '||length(p_initial_date));
DBMS_OUTPUT.PUT_LINE('ASI ESTAN ENTRANDO LOS PARAMETROS '||length(p_end_date));
DBMS_OUTPUT.PUT_LINE('customer ' || customer);
DBMS_OUTPUT.PUT_LINE('ASI ESTAN ENTRANDO LOS PARAMETROS quemados '|| length(initial_date2));
DBMS_OUTPUT.PUT_LINE('ASI ESTAN ENTRANDO LOS PARAMETROS quemados '|| length(end_date2));
DBMS_OUTPUT.PUT_LINE('customer ' || customer);
DBMS_OUTPUT.PUT_LINE('ASI ESTAN ENTRANDO LOS PARAMETROS convertidso '|| length(initial_date));
DBMS_OUTPUT.PUT_LINE('ASI ESTAN ENTRANDO LOS PARAMETROS convertidos '|| length(end_date));
OPEN cur_with_customer FOR
SELECT rct.customer_trx_id
,rctl.customer_trx_line_id
,hp.party_name ---cliente
,hca.account_number ----N° Cliente
,rctl.line_number-----item
,rctt.name---descripcion transaccion
,rct.trx_number -----numero
,rctt.type ------tipo de transaccion
,hp.party_id---control solamente
,rct.trx_date------Fecha de emisión Comprobante de Venta
,rct.attribute1 ---No. de autorización del Comprobante de Venta
,mp.attribute9||rct.trx_number N_Comprobante--No. de Comprobante de Venta
,rct.attribute4------ Unidad Estratégica de Negocio
,mp.attribute9---------N° de establecimiento
,rctl.description---------Descripción (Tipo de Combustible)
,rctl.quantity_invoiced----Cantidad Vendida en galones
,rctl.unit_selling_price ---Precio de venta unitario
-- ,rctl.taxable_amount-------Valor Base Imponible --restriccion
-- ,rctl.extended_amount---valor iva 12%
-- ,NVL(importe_12(rctl.customer_trx_line_id,rct.customer_trx_id),'N/A')
FROM ra_customer_trx_all rct,
ra_customer_trx_lines_all rctl,
hz_cust_accounts hca,
hz_parties hp,
ra_cust_trx_types_all rctt,
mtl_parameters mp
-- mtl_system_items_b msi,
--zx_lines zl
WHERE hca.account_number=customer
AND hca.party_id=hp.party_id
AND hca.cust_account_id=rct.sold_to_customer_id
AND rct.customer_trx_id=rctl.customer_trx_id
-- AND rctl.inventory_item_id=msi.inventory_item_id
AND mp.organization_id=rctl.warehouse_id
AND rct.cust_trx_type_id = rctt.cust_trx_type_id
AND rownum = 1
AND rct.trx_date BETWEEN initial_date AND end_date;<------------when I assign these parameters( initial_date AND end_date )--are the insert by parameter initial_date2 AND end_date2 defualt
DBMS_OUTPUT.PUT_LINE('customer ' || customer);
DBMS_OUTPUT.PUT_LINE('fe inicial ' || initial_date);
DBMS_OUTPUT.PUT_LINE('fe final ' ||end_date);
print_output(fnd_file.output, l_encoding_line);
get_xml(cur_with_customer, 'G_REGISTER', 'CABECERA', ERRCODE);
IF ERRCODE = 1 THEN
ERRBUFF := 'El reporte no arrojo datos para los parametros ingresados';
ERRCODE := 2;
RETURN;
ELSIF ERRCODE = 2 THEN
ERRBUFF := SQLERRM;
RETURN;
END IF;
print_output(fnd_file.output, '</XXOCS_TOTAL_VENTAS_SINEXP>');
END IF;
EXCEPTION
WHEN OTHERS THEN
print_output(fnd_file.log, 'Error Ventas sin Exportaciones:' || SQLERRM);
ERRCODE := 2;
ERRBUFF := SQLERRM;
-- Initialization
END xxxinitial_end;Welcome. As a note, this question has nothing to do with PL/SQL XML programming and everything to do with SQL and PL/SQL
That said, the simple test case I setup, because I don't have all your tables, works just fine.
declare
l_errcode VARCHAR2(300);
l_errbuff VARCHAR2(300);
PROCEDURE xxxinitial_end (ERRCODE OUT VARCHAR2
, ERRBUFF OUT VARCHAR2
, p_initial_date IN VARCHAR2 -- why not a date?
, p_end_date IN VARCHAR2 -- why not a date?
, customer IN VARCHAR2)
IS
initial_date DATE;
end_date DATE;
l_value VARCHAR2(10);
BEGIN
initial_date := to_date(p_initial_date, 'YYYY/MM/DD HH24:MI:SS');
end_date := to_date(p_end_date, 'YYYY/MM/DD HH24:MI:SS');
-- Not trapping the No Data Found on purpose
SELECT 'hit'
INTO l_value
FROM dual
WHERE SYSDATE BETWEEN initial_date AND end_date;
END xxxinitial_end;
begin
-- Test statements here
xxxinitial_end(l_errcode, l_errbuff
,'2013/08/19 00:00:00'
,'2013/10/19 00:00:00'
,null);
end;
As a comment above says, if you are dealing with dates, why not use a DATE parameter in the procedure and avoid the conversion in your code.
Also, you can simplify your code a bit by using a third sys_refcursor and setting one of the opened cursors to it. This allows you to pull out the common logic following the OPEN and only have one copy of it.
PROCEDURE xxxinitial_end (ERRCODE OUT VARCHAR2
, ERRBUFF OUT VARCHAR2
, p_initial_date IN VARCHAR2 -- why not a date?
, p_end_date IN VARCHAR2 -- why not a date?
, customer IN VARCHAR2)
IS
l_encoding_line VARCHAR2(240);
cur_without_customer SYS_REFCURSOR;
cur_with_customer SYS_REFCURSOR;
cur_comm SYS_REFCURSOR;
initial_date DATE;
end_date DATE;
BEGIN
l_encoding_line := '<?xml version="1.0" encoding=' || '"iso-8859-1"' ||
' ?>' || chr(10) || '<XXOCS_TOTAL_VENTAS_SINEXP>';
initial_date := to_date(p_initial_date, 'YYYY/MM/DD HH24:MI:SS');-----------------input parameters NOT WORKING
end_date := to_date(p_end_date, 'YYYY/MM/DD HH24:MI:SS');-------------------input parameters
IF customer IS NULL THEN
-------------------------cursor -----------------------------------
OPEN cur_without_customer FOR
SELECT rct.customer_trx_id
,rctl.customer_trx_line_id
,hp.party_name ---cliente
,hca.account_number ----N° Cliente
,rctl.line_number -----item
,rctt.name---descripcion transaccion
,rct.trx_number -----numero
,rctt.type ------tipo de transaccion
,hp.party_id--control solamente
,rct.trx_date------Fecha de emisión Comprobante de Venta
,rct.attribute1 ---No. de autorización del Comprobante de Venta
,mp.attribute9||rct.trx_number N_Comprobante---No. de Comprobante de Venta
,rct.attribute4-----Unidad Estratégica de Negocio
,mp.attribute9---- N° de establecimiento
,rctl.description-----Descripción (Tipo de Combustible)
,rctl.quantity_invoiced---Cantidad Vendida en galones
,rctl.unit_selling_price---Precio de venta unitario
--,rctl.taxable_amount-------Valor Base Imponible --restriccion
--,rctl.extended_amount---valor iva 12%
-- ,NVL(importe_12(rctl.customer_trx_line_id,rct.customer_trx_id),'N/A')
FROM ra_customer_trx_all rct,
ra_customer_trx_lines_all rctl,
hz_cust_accounts hca,
hz_parties hp,
ra_cust_trx_types_all rctt,
mtl_parameters mp
-- mtl_system_items_b msi,
-- zx_lines zl
--ra_batch_sources_all rbs
WHERE
--rct.trx_date BETWEEN initial_date AND end_date --parametros de fecha
rct.trx_date BETWEEN to_date('2013/08/19 00:00:00', 'YYYY/MM/DD HH24:MI:SS')/*initial_date*/ AND to_date('2013/08/23 00:00:00', 'YYYY/MM/DD HH24:MI:SS')/*end_date*/
AND rct.sold_to_customer_id = hca.cust_account_id
AND hca.party_id = hp.party_id
AND rct.customer_trx_id=rctl.customer_trx_id
--AND rctl.inventory_item_id=msi.inventory_item_id
AND mp.organization_id=rctl.warehouse_id
AND rct.cust_trx_type_id = rctt.cust_trx_type_id;
cur_comm := cur_without_customer;
ELSE
-----------------------cursor 2---------------------------
OPEN cur_with_customer FOR
SELECT rct.customer_trx_id
,rctl.customer_trx_line_id
,hp.party_name ---cliente
,hca.account_number ----N° Cliente
,rctl.line_number-----item
,rctt.name---descripcion transaccion
,rct.trx_number -----numero
,rctt.type ------tipo de transaccion
,hp.party_id---control solamente
,rct.trx_date------Fecha de emisión Comprobante de Venta
,rct.attribute1 ---No. de autorización del Comprobante de Venta
,mp.attribute9||rct.trx_number N_Comprobante--No. de Comprobante de Venta
,rct.attribute4------ Unidad Estratégica de Negocio
,mp.attribute9---------N° de establecimiento
,rctl.description---------Descripción (Tipo de Combustible)
,rctl.quantity_invoiced----Cantidad Vendida en galones
,rctl.unit_selling_price ---Precio de venta unitario
-- ,rctl.taxable_amount-------Valor Base Imponible --restriccion
-- ,rctl.extended_amount---valor iva 12%
-- ,NVL(importe_12(rctl.customer_trx_line_id,rct.customer_trx_id),'N/A')
FROM ra_customer_trx_all rct,
ra_customer_trx_lines_all rctl,
hz_cust_accounts hca,
hz_parties hp,
ra_cust_trx_types_all rctt,
mtl_parameters mp
-- mtl_system_items_b msi,
--zx_lines zl
WHERE hca.account_number=customer
AND hca.party_id=hp.party_id
AND hca.cust_account_id=rct.sold_to_customer_id
AND rct.customer_trx_id=rctl.customer_trx_id
-- AND rctl.inventory_item_id=msi.inventory_item_id
AND mp.organization_id=rctl.warehouse_id
AND rct.cust_trx_type_id = rctt.cust_trx_type_id
AND rownum = 1
AND rct.trx_date BETWEEN initial_date AND end_date;<------------when I assign these parameters( initial_date AND end_date )--are the insert by parameter initial_date2 AND end_date2 defualt
cur_comm := cur_with_customer;
END IF;
print_output(fnd_file.output, l_encoding_line);
get_xml(cur_comm, 'G_REGISTER', 'CABECERA', ERRCODE);
CLOSE cur_comm;
IF ERRCODE = 1 THEN
ERRBUFF := 'El reporte no arrojo datos para los parametros ingresados';
ERRCODE := 2;
RETURN;
ELSIF ERRCODE = 2 THEN
ERRBUFF := SQLERRM;
RETURN;
END IF;
EXCEPTION
WHEN OTHERS THEN
print_output(fnd_file.log, 'Error Ventas sin Exportaciones:' || SQLERRM);
ERRCODE := 2;
ERRBUFF := SQLERRM;
-- Initialization
END xxxinitial_end; -
Count (case when) not working in sql
Hi All,
I am trying to find the count of members for a perticular date range, it seems not working correclty.
Could any one help me out.
here is the query...I am getting same output for all the cases..please help
Select
t
.MemberNbr,t.patcom
count(case
when
datediff(d,
mbrs.DischargeDate,
convert(datetime,convert(varchar(12),t.specificdateofservice),112))
between
-1
and
-365
then t.MemberNbr
else 0
end)as
edvisits365daysprior
count(case
when
datediff(d,
mbrs.DischargeDate,
convert(datetime,convert(varchar(12),t.specificdateofservice),112))
between 1
and 3
then t.MemberNbr
else 0
end)as
edvisits3Days
count(case
when
datediff(d,
mbrs.DischargeDate,
convert(datetime,convert(varchar(12),t.specificdateofservice),112))
between 1
and 30
then t.MemberNbr
else 0
end)as
edvisits30Days
count(case
when
datediff(d,
mbrs.DischargeDate,
convert(datetime,convert(varchar(12),t.specificdateofservice),112))
between 1
and 60
then t.MemberNbr
else 0
end)as
edvisits60Days
count(case
when
datediff(d,
mbrs.DischargeDate,
convert(datetime,convert(varchar(12),t.specificdateofservice),112))
between 1
and 90
then t.MemberNbr
else 0
end)as
edvisits90Days
--,*--membernbr,specificdateofservice,count( membernbr)--, specificdateofservice)as visitcount--, patcom
--Into #Tmp_PPCSEDCnt1
From
stg_tbl_InPatientPrepost Mbrs
join
#Tmp_MCCSEDVisits t
on
mbrs.MemberNbr=t.MemberNbr
--where UPPER(t.MR_Line_Desc) in ('FOP EMERGENCY ROOM - HOSPITAL', 'FOP EMERGENCY ROOM Urgent Care',
--'PROF ER VISITS AND OBSERVATION CARE')
group
by t.MemberNbr,t.patcomYou may replace 0 as NULL and see how it works for you?
eg:
count(case when datediff(d, mbrs.DischargeDate,
convert(datetime,convert(varchar(12),t.specificdateofservice),112))
between -1 and -365 thent.MemberNbr else NULL end)as edvisits365daysprior -
NVL function is not working is Procedural Parameter's
Following is the Oracle Forms9i Program Unit. It's not working on Forms 9i though it's working on Forms6i. Please advise some solution, if anyone have experienced same kind of problem.
PROCEDURE test ( as_case_id VARCHAR2) IS
BEGIN
INSERT INTO tab1 ( col1 )
VALUES ( nvl(as_case_id, ' '));
END;
but this way it works fine
PROCEDURE test ( as_case_id VARCHAR2) IS
BEGIN
INSERT INTO tab1 ( col1 )
VALUES ( as_case_id );
END;
My forms9i runtime web session hangs and after sometime it becomes out oracle connection. It happens all the time.
Thanks,did you check the data directly in the database for the ' '(space) or in the form. The field might not show you anything in the form if it's a space.
Here is a simple test case:
I have a db table with one column populated with space ' '.
I have a form with one block with three fields based on that db table. The first field FIELD1 is for db field which holds the space, the 2nd is a db field which is length(FIELD1), and the 3rd field is a calculation field with formula nvl(length(:FIELD1),0). Then i query the block. What i see is the 1st column shows no space, the 2nd column is 1 and the 3rd column is 0. So i guess the form automaticly trim the field before displaying it in the screen.
I am using Forms 6i. -
Client variables not working in Apache and CF8
I have Apache and CF8 set up with multiple virtual hosts
locally for development(win xp pro, apache 2.2.4)
Client variables are not working. I can log into CF
administrator fine(not sure if authentication uses client variables
or not). Any site that I work on that uses client variables behaves
as if the variable is not defined after setting it then going to
another page that checks for its existence. I have verified that
client variables are set up in cf administrator.
Thanks for any helpThanks a lot. I understood the mistake. Pls do not spend time on this.
Thanks,
Swarna -
Cursor Not working stored Procedure but it working in anonymous Procedure
Hi Gurus....
My problem looks different.....my code was working as anonymous block where as it was not working as stored Procedure
Declare
cursor c_tblspace is
select fs.tablespace_name TBL_SPC_NAME
, round((100 *((sum(fs.bytes)) / df.bytes)), 2) PCT_Free
from sys.dba_data_files df
, sys.dba_free_space fs
,partition_tables ms
where df.file_id(+) = fs.file_id
and fs.tablespace_name =ms.tbspc_nam
group by fs.file_id, df.bytes, fs.tablespace_name;
begin
for rec_tblspace in c_tblspace
loop
if ( rec_tblspace.PCT_Free > 5 )
then
insert into t_space (tbspc_nm,ftr_spc)
values(rec_tblspace.TBL_SPC_NAME,'full');
dbms_output.put_line(rec_tblspace.TBL_SPC_NAME||' is full');
end if;
end loop;
end;where as it working while i want to create a stored Procedure...
create or replace procedure p_upd_space is
cursor c_tblspace is
select fs.tablespace_name TBL_SPC_NAME
, round((100 *((sum(fs.bytes)) / df.bytes)), 2) PCT_Free
from sys.dba_data_files df
, sys.dba_free_space fs
,partition_tables ms
where df.file_id(+) = fs.file_id
and fs.tablespace_name =ms.tbspc_nam
group by fs.file_id, df.bytes, fs.tablespace_name;
begin
for rec_tblspace in c_tblspace
loop
if ( rec_tblspace.PCT_Free > 5 )
then
insert into t_space (tbspc_nm,ftr_spc)
values(rec_tblspace.TBL_SPC_NAME,'full');
dbms_output.put_line(rec_tblspace.TBL_SPC_NAME||' is full');
end if;
end loop;
end;It was throwing following error...
PL/SQL: ORA-00942: table or view does not existJustin is right. You are creating definer right stored procedure.
Roles are disabled during definer rights stored procedure compilation and execution.
Here is the test case:
#1. Anonymous Procedure
HRDEMO@fmw//scripts> conn / as sysdba
SYS@fmw//scripts> create user todd identified by oracle;
SYS@fmw//scripts> grant dba to todd; --DBA role granted
SYS@fmw//scripts> conn todd/oracle
TODD@fmw//scripts> declare
2 cursor c is select * from dba_data_files;
3 begin
4 null;
5 end;
6 /
PL/SQL procedure successfully completed.
#2. Stored Procedure
TODD@fmw//scripts> create or replace procedure p1
2 is
3 cursor c is select * from dba_data_files;
4 begin
5 null;
6 end;
7 /
Warning: Procedure created with compilation errors.
TODD@fmw//scripts> show error
3/27
PL/SQL: ORA-00942: table or view does not exist -
BW hierarchy variable not working in Crystal Report 2008
Hi,
I have created BEx 7.0 report which has hierarchy on 0customer object, the report is working fine whith hierarchy variable. I have created Crystal Report by using this query as source. I have followed below link to create grouping to get data through hierarchy variable.
http://wiki.sdn.sap.com/wiki/display/BOBJ/BWHierarchiesinCrystalReports
But report does not work for hierarchy variable and report is blank. When I give filter of child node which has actual data then I get report output. For ex.
Below hierarchy for 0customer
11396
- 737007
- 123456
When I run report for 11396 then no data display but when I run 737007 child node I get report output but with blank group name.
Can anyone came accross this issue. Please guide me . Thanks in advance.Thanks Ingo for your reply..
The word filter means, I have hierarchy node variable in the BEx report that has become Parameter in CR. When I give hierarchy node variable value of parent node then there is not data display but for the child node I get the data.
For ex. In the info cube there is data for 730707 customer but in the customer hierarchy the parent node of 73707 is 11396. I am giving 11396 in the variable pop screen for hierarchy variable. I do not see any data but for 73707 I get data.
User does not know 73707, he always enter 11396 customer no. and he gets data in BEx query that is source of CR. but crystal report is not showing data for 11396.
One more point I want to tell here, I am saving CR at my local system not to SAP BW server.
Hope this clear my issue.
Harish Swami
Edited by: hswami27 on Jan 31, 2011 8:17 PM -
Hi all,
Previously, we were using OBIEE 11.1.1.5.0 and we were able to assign users to application roles by using the initialization block to assign the ROLES session variables.
1. My USER_SECURITY table in Oracle database:
USER_NAME | USER_ID | ROL
user1 | 1723 | GobalDataRole
user2 | 1739 | GobalDataRole
user3 | 1743 | GobalDataRole
2. The SQL query in my session initialization block:
select USER_NAME, USER_ID, ROL
from USER_SECURITY
where USERNAME = ':USER'
3. The row-wise initialization option is not checked.
4. In the Oracle Enterprise Manager Fusion Middleware Control, we created new application role: GobalDataRole and sync with rpd.
5. The GobalDataRole is used in the RPD to filter the data under permissions --> data filter. GobalDataRole only has access to Country A data.
6. Result: under my account, also in rpd Manage --> Sessions, user variable details
User_name , user_id & Rol variable is working fine as expected,
When we log in as user1, we can see in My Account, user assigned to: BI Consumers; Authenticated Role; GobalDataRole
When we log in as user2, we can see in My Account, user assigned to: BI Consumers; Authenticated Role; GobalDataRole
When we log in as user3, we can see in My Account, user assigned to: BI Consumers; Authenticated Role; GobalDataRole
User1, User2, and User3 are able to see the data correctly according the their data access setup.
Now, we using OBIEE 11.1.1.7.1 and using the same method, but we not able to assign users to application roles by using the initialization block to assign the ROLES session variables anymore.
Result:
User_name & user_id variable is working fine as expected, but the ROl variaible is not capturing the DB value,
When we log in as user1, we can see in My Account, user assigned to: BI Consumers; Authenticated Role
When we log in as user2, we can see in My Account, user assigned to: BI Consumers; Authenticated Role
When we log in as user3, we can see in My Account, user assigned to: BI Consumers; Authenticated Role
User1, User2, and User3 can see all data (which is wrong) because they are not assigned to the correct application role that sets the data restriction/filter.
Has anyone encountered the same issue? Any advice on how to solve this?
Thanks in advance!
Satheeshkumar PThanks user10615659 ,
- Yes the variable ROLES available in OBIEE 11.1.1.7.1
- Tested the init block and variables in offline rpd its working as expected.
- In online rpd, except ROLES and GROUP variable remaining variables working fine.
- Verified log file in both online and offline init block testing - the init block execution is successful.
Thanks -
Text Variable not working correctly
In CS3 I could create a TEMPLATE (.indt) with the "creation date" text variable in it and when I opened it it would have the CURRENT DATE (the date the new file was generated from the template) . In CS4 it opens with the date the TEMPLATE was MADE and not the current date (the day the new file was generated). I need the template to open with the current date (the day the template was opened). I tried using the "modification date" variable which works the FIRST time but if I open it the next day the date changes. I need the date to remain the same as the creation date. Does this make sense? Why did Adobe change the behavior of this? Please help.
-John StreeterHi Rakesh,
Just curious what is the purpose of creating a hidden column as suggested? Anyway, I have created it but nothing changes.
Allow me to clarify my situation again.
I have three columns:
1. Actual This Year
Type: Selection
2. Actual Last Year
Type: Selection
3. % of Actual This Year / Actual Last Year
Type: Formula
Definition: (Actual This Year) %A (Actual Last Year)
All columns use &0T_FYEAR& as text replacement variable. As such, all title would have year text.
The first two columns have been restricted with Fiscal Year variable, 0P_FYEAR.
1. Actual This Year
0P_FYEAR
2. Actual Last Year
0P_FYEAR - 1
Upon executing the query, I got the first two columns displaying their titles right, but the third column does not.
For example, let's assume I entered 2008 for 0P_FYEAR variable, the columns would display the following titles:
1. 2008
2. 2007
3. &0T_FYEAR&
I need the third column to display current fiscal year i.e. 2008 but it does not.
Appreciate your help! -
Bind Variable NOT working in APEX 4.0 within charts SQL
All,
I had a chart working fine in 3.2 which had a bind variable like :P11_EMP_NAME, when I created the same chart in 4.0 using the same query it did not work, until I changed the variable to v('P11_EMP_NAME'). Does anyone have experienced the same behaviour?
Thanks
VenkatHi Deb,
Both of your queries are using multi-series syntax i.e. returning more than one series of data, therefore your generated chart is actually generating 6 series rather than just the two that you're aiming for. You could try changing your queries to ensure they each generate a single series of information, which would then result in the extra Y-axis being applied to your "Series 2". Here's an example of what I mean:
Series 1:
select null link, label, value from (
select 'test' label, 1 value from dual
union all
select 'test2' label, 2 value from dual
union all
select 'test3' label, 3 value from dual
)Series 2:
select null link, label, value from (
select 'test' label, 100 value from dual
union all
select 'test2' label, 200 value from dual
union all
select 'test3' label, 300 value from dual
)I hope this helps.
Regards,
Hilary -
Evaluate variable Not working properly
Hi
When i used Evaluate variable , It is having list of Operator (=,<>,IN etc).
When is specified operator '=' and give one value its working properly.
eg. Select name from table ;
O/p = AA
In ODI , Operator =AA its working .
But when i specified Operator "IN" and giving value ('AA','AB') Or value (AA,AB) its not working propelry.
Any other operator or any other option to use IN operator.
Thanks
AshwiniHi,
I never saw that "IN" woks!
There is a workaround, use a at variable refresh tab a command like: (you can refresh the variable from itself)
select case when '#project_code.my_var' in ('ab','a','x')
then 'OK'
else 'KO'
end
from dual
put it as refresh step and add a new instance as evaluate "= OK"
Does it help you?
Edited by: Cezar Santos on 05/02/2009 08:59
Maybe you are looking for
-
How do I get back my missing Personal Hotspot on My ipad mini?
I had t before and I don't know what I did but its missing. I tried resetting Network settings, restoring but nothing works.
-
Hi , I hope someone can help me out. After having to reboot my iPad it seem that I can get two of my movies to go back on to it from my library. Any advise would be great. Thanks
-
Party in a b2b Communication.
All, I am currently involved in getting a naming conventions document for a landscpae that has more B2B scenario. Think of B2B and the first think that comes to mind is "Party" . I know you create the Party in the Integration Directory and then add t
-
New to Mac - does upgrade to Leopard require reinstall of existing apps?
We've moved my wife from a PC to a MacBook Pro a couple of months ago (running Tiger). We purchased & had installed several apps such as Parallels (pointing to a Boot Camp instl of Windows XP Pro) and Photoshop Elements, etc. that she needs for her w
-
Feature: Show ONLY IMAGES of a webpage??
Hello... I recently installed some add-on Safari enhancement type things (like Safari Enhancer and SafariStand) while at the same time, checking out Firefox as well. It was LATE at night and I do NOT recall what I did but I brought up some pageview f