I have a stored procedure which has varchar2 as IN and sys_recursor has OUT parameters.
CREATE OR REPLACE PROCEDURE check_values (
my_values IN emp.dept_no%TYPE,
p_cursor OUT sys_refcursor
)
[Code]....
/The problem I am facing is in where condition, if I give quoteValues it doesn't fetch me any records when I execute the procedure from sqlplus, but if I am giving my_values it does fetch me records. I am receiving IN parameters like 9856,9712,8723, so first I put single quote around the emp_no and pass that to where condition.
the following procedure successfully compiled and executed. How to access the values returning from this procedure in another procedure or PLSQL block.
CREATE OR REPLACE PROCEDURE test IS
cursor c1 is SELECT a.idnumber, a.idp FROM holdings a; r1 c1%rowtype;
BEGIN
open c1; loop fetch c1 into r1; exit when c1%notfound; DBMS_OUTPUT.put_line (r1.idnumber||'--'||r1.idp); end loop; close c1; END;
However, I'd also like it to return any product that doesn't have a TEST_UOM_GROUP, for example the 'Bud'.I've hit a brick wall and just keep going around in circles and not acheiving the result I'm after!how to either change the SQL Query.
I was working on an applications program It is written in PL/SQL . It is running on an oracle 8i database It was not written by me but now I am responsible of it. I made some changes to database tables for this years regulations. Everything was working fine but yesterday I have recompiled two of the packages for some regulations and one of the procedures was stopped working.
It is called 'sayfa2'. Packages names are 'aday1' and 'aday2'. They both have a procedure called sayfa2 and both of them don't work now. They gave me no compilation errors. All I did is I have copied the original code from toad and compiled it at sqlplus I have changed nothing except some texts inside html tags. I couldn't guess what is wrong.
It actually converts to html pages. All procedures are working fine except sayfa2. aday1 is for to fill information and submit but when I click submit button it gives an error:
The requested URL /pls/kon/aday1.sayfa1 was not found on this server. Oracle HTTP Server Powered by Apache/1.3.19 Server at ...
There is also a problem with Turkish characters they don't appear correctly.
Below is sayfa2 and I also added aday1 package could you have a look at it .
PROCEDURE sayfa2(stuid VARCHAR2,tckimlik VARCHAR2, ad VARCHAR2, ad2 VARCHAR2, soyad VARCHAR2, sex VARCHAR2, mdurum VARCHAR2, bad VARCHAR2, aad VARCHAR2, dyer VARCHAR2, dgun VARCHAR2, day VARCHAR2, dyil VARCHAR2, nil VARCHAR2, nilce VARCHAR2, nkoy VARCHAR2, cilt VARCHAR2, asira VARCHAR2, sira VARCHAR2, asuba VARCHAR2, kang VARCHAR2, agorev VARCHAR2, [code].......
I am trying write a script that will return all values (based on the minimum tarif) from the Germany table for any duplicate values. Duplicate values are any values with the same UFI, ZC,limitid,depot. The German table also contains the fields tarif, city, supplier, etc.
Below is the script I have previously used to sort out duplicates. I have tried 50 different ways get it to return just lines for the minimum tariff but haven't been successful.
select * from Germany t where (ufi,zc,limitid,depot) in ( select ufi,zc,limitid,depot from ( select ufi,zc,limitid,depot, count(*) n from Germany t group by ufi,zc,limitid,depot) where n<>1 )
I have a table second_table which has a username and code field. A username (not the primary key) may be entered multiple times with different codes, or a single code 'ALL', in which case, the codes have to be fetched from 'third_table'. I am unable to form a 'case' clause to handle the fact that a list has to returned when the 'code' field from the second_table returns 'ALL'.
e.g.
Second_table username code A ALL B 23 B 56 B 33
Third_Table code 67 78
So, when the user asks the codes for user A, he should get 67 and 78 and when he asks for the user B, he should get 23,56 and 33
I am using functions to return multiple values of two rows or multiple rows.
For example emp id = 100 and i need to return the value for this(empid) input and output of this first_name and salary.
I am tried in this way below but got errors (ORA-00932: inconsistent datatypes: expected NUMBER got HR.EMP_TYPE)
create or replace type emp_type as object(first_name varchar2(20),salary number);
create or replace function f1(empid in number) return emp_type as emp_record emp_type; begin select first_name,salary into emp_record.first_name,emp_record.salary from employees where employee_id = empid ; return emp_record; end; /
I have a PL/SQL function where i call java class. In java i`m making some calculations and i need to return to body of PL/SQL function some values ( like 6 to 10, few numbers, string, 1 xml and 1 html).
I will show pl/sql function..
CREATE OR REPLACE FUNCTION GET_TAB(P_CURS SYS_REFCURSOR) RETURN TYP1_TAB PIPELINED IS OUT_REC TYP1:=TYP1(NULL,NULL,NULL,NULL); V_NAZWA VARCHAR2(5); V_NUMER NUMBER;
i'm trying to make a sp/function for inserting a record and return the new index.The previous code used regular inserts and needed an additional round-trip to get the id before inserting,, since this is part of a import routine performance is an issue.
CREATE OR REPLACE PROCEDURE SaveAisHeader ( P_Id Out Number, P_ImportedOn IN Date, P_Aisimporttypeid In Number, P_Description In Varchar2, P_Importedby In Varchar2 [code].....
I have a table with multiple rows for the KEY attribute(its not a primary key) and a Rank for each row.
I want a query which fetches one row per KEY attribute.The row with lesser Rank should be considered. But in-case if the value is null for any column the value for next Rank should be considered.
WITH TMP_TBL AS ( SELECT * FROM ( SELECT 'A' DUN,'1' RNK,'A21' col1,NULL col2,'A41' col3,NULL col4 FROM dual UNION ALL SELECT 'A','2','A122','A23',NULL,NULL FROM dual UNION ALL SELECT 'A','3','A32','A33',NULL,'A35' FROM dual [code].......
DUN is the KEY attribute . RNK is the Rank for each Row. COL1... COL4 are data attributes
I want this to be done with SQL only. So I tried various ways but none were successful.Finally I created a Multi Row function row_nvl and it worked.
SELECT DUN, row_nvl(rownvl_param_type(RNK,col1)), row_nvl(rownvl_param_type(RNK,col2)), row_nvl(rownvl_param_type(RNK,col3)), row_nvl(rownvl_param_type(RNK,col4)) FROM TMP_TBL GROUP BY DUN
But I don't think my manager will allow me to deploy a Multi Row function .
FUNCTION normalize(str IN VARCHAR2) RETURN VARCHAR2 IS BEGIN RETURN TRANSLATE(LOWER(str), 'äàáâãăāåąæčçðďéèëêěĕėęğģġîĭïīìíłļľŀñńňņöóòôõσøőřśŝšşţüúùûǔųūůŵýÿżźžżαβßγδεζŋηικλμµνξπρσςτυφω', 'aaaaaaaaaaccddeeeeeeeegggiiiiiillllnnnnoooooooorsssstuuuuuuuuwyyzzzzassydeznniklmmnxprsstufo' ); END;
I'm tired to add missing characters in this list...
What I would like is that all characters with an accent or diacritics should be replace by their "base" letter (ë -> e) and Greek letters to be replace by their corresponding values (ω (omega) -> o)
Is there any way of returning output parameter values to calling environment before completion of procedure execution. I may achieve it by using GTTs, looking for any other way (because calling environment again need to issue select statement to retrieve data from GTT).
Example case:
Procedure have multiple ref cursors as out parameters. .... ... if exp1=exp2 then open v_ref_var1 for select ...from ... ; end; [code]..........
If the first if condition satisfies, ref cursor - v_ref_var1 data should be immediately available for the calling environment.
Well i like to display the Values in Boiler Plate/Text. For Example, i have Report with Address Columns. for Tin No: i have Hard coded as TIN: 34XXXXXX01 and i like to change this hard coded item as TIN: 34XXXXXX02 so during Runtime if the input is changed the above item to be changed.
resolve issue while modified the user function code for returns the values as timestamps
---function code
create or replace function fun_test_timestamp(P_HOUR varchar2) return varchar2 is sql_stmt varchar2(1000); begin
[Code].....
Input:- select fun_test_timestamp('5') from dual;
Output:-
SELECT CURRENT_TIMESTAMP - INTERVAL '5' HOUR FROM DUAL;
Modified Fun Code:
create or replace function fun_test_timestamp(P_HOUR varchar2) return timestamp is sql_stmt varchar2(1000);
[Code]...
Input:- select fun_test_timestamp('5') from dual;
Output:-
ORA-00911: invalid character ORA-06512: at "NETVERTEXTRUNK.FUN_TEST_TIMESTAMP", line 8 00911. 00000 - "invalid character"
*Cause: identifiers may not start with any ASCII character other than letters and numbers. $#_ are also allowed after the first character. Identifiers enclosed by doublequotes may contain any character other than a doublequote. Alternative quotes (q'#...#') cannot use spaces, tabs, or carriage returns as delimiters. For all other contexts, consult the SQL Language Reference Manual.
I am trying to return a value of an oracle stored procedure using Excel VBA.
OS: Win XP SP3 Excel 2003 Ora Client: 11g
By trying different things I have noticed, that I could have troubles with the ODBC-connection. Maybe I am not using the right one. To store data returned from select statements I have an ODBC-Connection (Driver: Oracle in XE), which works perfectly, e.g.:
'----------------------- Sub Extract_Data() Dim cn As ADODB.Connection Dim rs As ADODB.Recordset Dim db_name, UserName, Password As String cn.Open db_name, USerName, Password
[code]....
When debugging the connection string, I find the Provider=MSDASQL5.1.
My task is I want to retrieve all the Insert Statements of the rows that are present in each table of a particular Schema.
When I give input as Schema name(Scott) in a Procedure, Then the procedure retrieves all the Insert statements of rows of all tables that are present in scott user.
For this I started like this..
CREATE OR REPLACE PROCEDURE MYPROC(UID DBA_OBJECTS.OWNER%TYPE) AS CURSOR MYtab IS select o.owner, o.object_name from dba_objects o where O.OWNER=UID
[code]....
When I execute this procedure I got the result as follows.
EXEC MYPROC('SCOTT'); insert into DEPT(DEPTNO,DNAME,LOC) values ( insert into EMP(EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values ( insert into BONUS(ENAME,JOB,SAL,COMM) values ( insert into SALGRADE(GRADE,LOSAL,HISAL) values ( insert into PROJECT(PNO,PNAME,PMGR,PSTART,PEND,BUDGET) values (
[code]....
As you see that I have executed successfully till each table columns.But How to retrieve the values in this?
CREATE TABLE t2 ( id NUMBER, ename2 VARCHAR2(20), sal2 NUMBER, job2 VARCHAR2(20), conid NUMBER
[Code]...
My requirement is like when I am calling the procedure P1 with some values then it should check the table "t2".And table "t2" is linking with table "t3".
So what ever the column "verify" is there, it should check the incoming values against it. If matches success otherwise reject it.Later the incoming values is stored different tables.I am doing it in the above way by hard coding some value.
BEGIN p1(1,'MILLER',500,'ADMIN'); --REJECT p1(1,'MILLER',5000,'ADMIN'); --ACCEPT P1(2,'MILLER',5000,'SALESMAN');--ACCEPT END;
I have one procedure , which calls the DBMS_scheduler.run_job , which calls the Shell Script. now based on the shell execution i need to return the message lines to procedure.
how can i make this script into a function or procedure which instead of user change the crime_id :=4 or 5 directly it actually can grab the id from a update statment like
UPDATE CRIME_STATUS SET CRIME_STATUS = 'open' WHERE CRIME_ID = 9; pick 9 and insert into the above statment so it runs as normal
The goal is to create a stored procedure that will retrieve multiple values from a table.
GUI is in Java and they will trigger our procedure to show list of all employees and their roles , doj etc.
So I wrote the following procedure. --------------------------------- create or replace PROCEDURE emp_test( c_cursor OUT SYS_REFCURSOR) AS BEGIN OPEN c_cursor FOR SELECT emp_name, emp_doj, emp_role FROM emp_table ; END; ---------------------------------
I'm using sql developer, stored procedure is compiled and I can manually run it by right clicking on the procedure and click 'Run'.
When I intend to run it by executing the script "Execute Procedure name ", I get errors.
In SQL Developer, I open new SQL file and key in
EXECUTE emp_test;
Highlight it and run the script, here is the list of errors that I get.
------------------------------------------- Error starting at line 18 in command: execute frm_lst Error report: ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'emp_test' ORA-06550: line 1, column 7: PL/SQL: Statement ignored 06550. 00000 - "line %s, column %s: %s" *Cause: Usually a PL/SQL compilation error. *Action: --------------------------------------------
Issue 2:
Instead of using cursor, is there a way to use multiple parameters and insert the data retrieved from select column_name from table into these parameters and build it in a stored procedure. I tried something like below which did not work. ____________________________________________________
CREATE OR REPLACE PROCEDURE emp_test1 (e_name OUT emp_name%TYPE, e_dob OUT Edob%TYPE) IS BEGIN SELECT emp_nam, Edob INTO e_name, e_dob FROM emp_table END emp_test1; End; ______________________________________________________
Just so you know, there is no input parameter or input feed, when called the procedure should return all the values.