For the customer ID 123 I want to return Z1, for customer 678 I want to return S2 and for customer ID 345 I want 11
Problem is that I'm new to the concept of looping. I know how to write a function that accepts customer_id as a value write a cursor and then check IF hierarchy = 1 the return FUNCTION_CODE IF hierarchy - 2 THEN ...
but I need something more universal as some of the customers may have hierarchy function 1 and that would be the top one for him but others might have function of hierarchy 10 as top and checking all of the possibilities using if would be just stupid. So how to write something universal ? And of course if function did not find any customer_id then return null.
I have an Image Type on a forum page. I want a default "not-found" image to display if the BLOB column value is null or if there is no data for that search value. The image is stored with the app: #APP_IMAGES#not-found.png
WHILE EXISTS ( SELECT * FROM tblOrgChart WHERE fxOrgID = v_chrTempKeyDept ) LOOP v_intDept := CAST(v_chrTempKeyDept AS NUMBER) + 1 ; v_chrTempKeyDept := LPAD('',3 - LENGTH(CAST(v_intDept AS VARCHAR2)),'0') || CAST(v_intDept AS VARCHAR2) ; END LOOP;
Error: PLS-00204: function or pseudo-column 'EXISTS' may be used inside a SQL statement only
I'm trying to create a function that simply returns the current database name (e.g: select db_unique_name FROM v$database ) from a function but when I compile it comes up with :
Error(9,5): PL/SQL: SQL Statement ignored Error(9,44): PL/SQL: ORA-00942: table or view does not exist
I am compiling and running this as the SYSTEM user and I do think that I need to set privledges/roles, etc to allow this (since I have read that using synonyms in functions/procedures requires permissions...but I cannot seem to find anything that tells me exactly what role/priveledge I need to grant/allow to let this happen.
DECLARE CURSOR C1 IS SELECT EMPLOYEE_ID FROM EMPLOYEES; TYPE EMP_ID_TYPE IS TABLE OF EMPLOYEES.EMPLOYEE_ID%TYPE INDEX BY BINARY_INTEGER; TABLE_EMP_ID EMP_ID_TYPE; BEGIN
[code].....
But when i am executing below code it is showing error as subprogram or cursor 'C1' reference is out of scope
DECLARE CURSOR C1 IS SELECT EMPLOYEE_ID FROM EMPLOYEES; TYPE EMP_ID_TYPE IS TABLE OF EMPLOYEES.EMPLOYEE_ID%TYPE INDEX BY BINARY_INTEGER; TABLE_EMP_ID EMP_ID_TYPE; BEGIN
[code].....
The only difference in above two blocks is that EXIT WHEN Statement.
I have a function that returns the situation for one month for some database. I need to implement it in some report medium for one year. The one year function works ok.
My problem is when trying to make another function that runs the monthly function 12 times and that error is "PLS-00653: aggregate/table functions are not allowed in PL/SQL scope".am trying to get around some restrictions and somehow until this part things seem to be ok.
I tried to use a union with 12 blocks but it works very slow in the reporting environment and now i want to try to make another function that runs another function 12 times depending on the parameter.
here is the code (there might be some name misuse since i had to change the names of the original code -
CREATE OR REPLACE FUNCTION anual(monthh in varchar2, year IN VARCHAR2) return anual_REP_var PIPELINED is BR anual_REP:=anual_REP(NULL,NULL, NULL,NULL); contor INT(2);
1. For each of the Filename, if originating_site is not the same as receiving_site, it means that the file has been sent to receiving_site but has not been acknowledged received yet.
2. For each of the Filename, if originating_site is the same as receiving_site, it means the file has been sent and received by the receiving_site.
My task is to list out all the Filename per receiving_site that has been sent, but not received yet by the receiving_site. For example from the sample data above, I am expecting to see that siteA, fileB has not been received yet.
How can I do that? I had tried MINUS and NOT EXISTS command, but I am just not able to get the result that I want.
dbms_lob.append(temp_clob,to_clob(' <property>'||crlf)); fol:=lb_folios.get_chap1_sec1(folioid); fetch fol into recid,rec_nr,text,shares,obj_size,monetary_sum,rec_status; if fol%found then dbms_lob.append(temp_clob,to_clob(' <chap1_sec1>'||crlf));
[Code]....
And I have error on "select jnl_id into jid" this line. And the error text is "no data found". And I know that there is no data in the table column jnl_id.
We have the following trigger in database, whenever we try to insert the record in WIP_OPERATIONS , NO DATA FOUND exception has been thrown, when we debugged, we did not find any issue. The first select statement is getting failed even though there is the value coming for :NEW.wip_entity_id and when we execute the query separately in database with the :NEW.WIP_ENTITY_ID, its getting the value. What could be the reason? Can't we use SELECT Statement in AFTER or BEFORE INSERT trigger?why its throwing NO_DATA_FOUND Exception?
CREATE OR REPLACE TRIGGER sdm_brasil_wj_ops_iface_trg BEFORE INSERT OR DELETE ON WIP_OPERATIONS REFERENCING
I have a stored procedure that is returning no data. I have read this is most common in stored procedures that use a SELECT INTO that tries to put a null in the variable.First, the stored procedure (from SQL Developer) then th execute and error.
PROCEDURE prc_add_address (addr_id OUT integer, addr_type_id IN integer, addr_line_1 IN varchar2, addr_line_2 IN varchar2 := null, addr_line_3 IN varchar2 := null, prov IN varchar2 := null, zip_id IN number, country_cd IN varchar2 := 'USA', addr_start_date IN date, addr_end_date IN date := null, changed_by IN varchar2, changed_date IN date, channel_txt IN varchar2 := null)
[code]....
The sad conclusion:
Error starting at line 1 in command: declare addrid integer := 0; BEGIN pkg_vic_person.PRC_ADD_ADDRESS (addrid, addr_type_id => 1, addr_line_1 => '351437 Tall Blvd', zip_id => 14906, addr_start_date => '01-FEB-2011', changed_by => 'RS', changed_date => sysdate);
I got this error on the code below when i insert for example a record in a table "pedidos_teste" (insert into sgc_supergestor.pedidos_teste select * from sgc_supergestor.pedidos where IDPC=181 and IDPEDIDO=48 )
Below is the error: ORA-1403: ORA-01403: no data found
CREATE OR REPLACE TRIGGER SGC_SUPERGESTOR.pedidos_teste_I_U_D after INSERT OR DELETE OR UPDATE ON SGC_SUPERGESTOR.PEDIDOS_TESTE REFERENCING NEW AS NEW OLD AS OLD FOR EACH ROW [code]....
My cursor went to the exception when its got the error " ORA-01403: no data found"
But my cursor need to run even though it got the error " ORA-01403: no data found"...This is my exception part
EXCEPTION WHEN OTHERS THEN DBMS_OUTPUT.put_line (c1rec); DBMS_OUTPUT.put_line (SQLCODE); DBMS_OUTPUT.put_line (SQLERRM); -- RETURN NULL; -- code change added as part of GCA642 -- END END get_geo_test1;
have a cursor populating an array displaying data not found. As usual with these things, a few displays normally show the offending row but in this case, the display is showing data so I dont understand it. Ive inherited this and shortened it a bit to display whats going on.
declare v_errno number; cursor c1 is <really big sql statement>;
[Code]...
now we come to run it, I tried first to see was it data and then I outputted the iteration itself. the first iteration is fine, the second iteration shows the column in the array has data but Im still getting the 01403.
the error can be generated even displaying the array value. If the array wasnt populated I wouldnt expect the col value to display in the error.
exec my_proc; iteration : 1, col1 value : 43 Error iteration : 2, col1 value : 43); * ERROR at line 1: ORA-01403: no data found ORA-06512: at "my_proc", line 34 ORA-06512: at line 1
if I click button RUN here -> f?p=4000:1500 i have error: ORA-01403: no data found
Problem is if I set Application - BuilderApplication xxx - User Interfaces - User Interface Details - Home URL = f?p=&APP_ALIAS.:2:&SESSION. (&APP_ALIAS searched alias for apex builder).
I have xml data in one oracle table as records. I want to get the node name from each record (Next node of rowset and row). Total no.of records in oracle table is 15465. By using for loop i have try to get this but got the following error.
code is...
1 CREATE OR REPLACE PROCEDURE DDI_TEST.SCHEMA_IMPORT9 2 AUTHID CURRENT_USER 3 AS 4 V_Xml XMLTYPE; 5 V_Xml_Ind XMLTYPE; 6 V_Node VARCHAR2 (50); 7 V_Cnt NUMBER := 1;
[code]....
ERROR is..
ORA-31186: Document contains too many nodes ORA-06512: at "SYS.XMLTYPE", line 111 ORA-06512: at "DDI_TEST.SCHEMA_IMPORT8", line 18 ORA-06512: at line 1
Even i used one more 'for loop' (at line 18 )to get additional nodes, same thing happens.
Here is my req - There are 2 columns C1, C2 - both of which capture a different set of values in 2 seperate custom oracle apps forms.
I have a RDF query to get the result set of C1,C2.
When this query does not return any values I need to look in form 2 and handle each value of C1 separately. I do not know how to achieve this with formula column - since I can perform checks/validations on the data returned by the query using a formula column.
i have a table that contains employee id, employee name , so if i gave the correct employee id in where clause of select statement it will show employee name, in case if i give the employee id that does not exist in the table it will show 'Employee name is not found'..
CREATE OR REPLACE TRIGGER LOGONTRIG AFTER LOGON ON DATABASE DECLARE v_temp NUMBER; V_bypass_trg_flag VARCHAR2(1);
[code],...
This trigger got successfully compiled. and when am trying to connect to the db with other user its giving me error "ora-06512 : at dbms_session".When i grant dba privillage to that user am successfully able to login to db.
On the weekend, I ran the repair chained rows in Toad and compile invalid objects in Toad.I don't know this problem is associated with that job, it has no problem first day and today some problem was detected from customer side. It shows Ora-12516 and Ora-96512, I will attach package sql and error screen shot, could you interpret what is wrong with the Oracle?
I can post up screen shot cause I don't have right.It was Korean and if I translate to English, kind of "Server can't proceed - Ora-12516 TNS: listener can't find appropriate handler with protocol stack.
Ora-06512: "CWMED.PKG_MEDI_AS_TOCALL" line 226 Ora-06512: "CWMED.PKG_PDA_MEDI_AS" line 1765 Ora-06512: "line 1".
select * from test_1 IDNameTotal ----------- 1A100 2B100 3C100 4D100
test_2 table contains the concatination of ID's with comma seperated. Actually in this table ID column is of datatype varchar2. select * from test_2 ID ---- 1,2,3
My requirement is to select the data from test_1 table where the id values in this table exists in test_2 table. I tried with the belowselect statement, but could not get any data.
SELECT * FROM test_1 WHERE to_char(id) IN (SELECT id FROM test_2)
create table test_1 (id number, name varchar2(100), total number) create table test_2(id varchar2(100)) insert into test_1 values (1,'A',100) insert into test_1 values (2,'B',100) insert into test_1 values (3,'C',100) insert into test_1 values (4,'D',100)
I have the following chunk of code, which could return no rows, one row or many rows. When it returns one or many rows the DBMS_OUTPUT.PUT_LINE prints out my values. When no data is found 'Hello' is not printed?
Suggest a way I can change the code to make the exception print when no data is found?
SET SERVEROUTPUT ON; BEGIN FOR prec IN ( select * from xxx.part_maint where drop_partition = 'Y' ) LOOP DBMS_OUTPUT.PUT_LINE (prec.SCHEMA_NAME || ' ' || prec.OBJECT_NAME); END LOOP; EXCEPTION WHEN NO_DATA_FOUND THEN DBMS_OUTPUT.PUT_LINE ('hello'); END;