Application Express :: Using Variables In PL/SQL Function Body Returning SQL Query?

Nov 20, 2012

I have this procedure

POSTCODE_TO_LAT_LNG_GM_API(postcode  IN  VARCHAR2, lat  OUT NUMBER,  p_long OUT NUMBER)

to convert a postcode into lat/long values. I then need to add them to the returned SQL statement so I used the string concat operator || with to_char but it comes up with this error when I try to apply the changes: Query cannot be parsed within the Builder. If you believe your query is syntactically correct, check the ''generic column'' checkbox below the region source to proceed without parsing.

ORA-00936: missing expressionh4.

h4. btw I'm using Oracle 11g release 11.2.0.3.0 and Apex version 4.1.1.00.23

DECLARE
l_lat NUMBER;
l_lng NUMBER;
l_SDO_GEOMETRY SDO_GEOMETRY;

[code]...

View 9 Replies


ADVERTISEMENT

Application Express :: Function Returning Blob Content

Sep 10, 2012

I am using the below function to return a blob (CSV) content, this is working fine..But i need to modify this function to display headline for the report and fixed width column in CSV ( then user no need to expand the each and every column ).

create or replace function GET_BLOB (
p_query varchar2
) return blob as

l_cursor integer;
l_cursor_status integer;
l_col_count number;
l_desc_tbl sys.dbms_sql.desc_tab2;
l_col_val varchar2(32767);
[code]....

View 10 Replies View Related

Application Express :: Validation - PLSQL Function Returning Boolean Bug?

Mar 12, 2013

Application Express 4.1.1.00.23 ( plus all earlier versions that I've ever used)

When using the wizard to create a Validation of type "PLSQL Function returning Boolean", why is it mandatory to enter a value in the text field "Error Message" on the screen that follows? This message is never used as the message actually displayed comes from a PLSQL return statement.

View 5 Replies View Related

SQL & PL/SQL :: Create View From Dynamic Query (or Function Returning Query)

Dec 5, 2012

I have a dynamic query stored in a function that returns a customized SQL statement depending on the environment it is running in. I would like to create a Materialized View that uses this dynamic query.

View 1 Replies View Related

Application Express :: Change Page Template Body To Use 8 Columns Instead Of 12?

Nov 6, 2013

Apex Version: 4.2.0.00.27Theme: 25 I have a page that I need to divide by 8 segments, rather than 12 ( I will need to place items and buttons in one of the 8 columns). To begin, I have made a copy of the One Level Tabs - No Sidebar page template. I have tried to edit this template, and played with multiple combinations changing the Grid Layout and Display Points settings, but instead of creating a page that has 8 columns, that span the width of the page, I am just left with blank space. See attached:.[URL] And these are the Page Template Settings:[URL]  Is it possible to change the body section of the page template to have 8 columns span the entire width, without the dead space?

View 2 Replies View Related

Application Express :: Collection In 4.1 Using Bind Variables?

Oct 4, 2012

I am trying to create a collection using bind variables in APEX 4.1. I have the following procedure but all I get is an error in the debug page DOH ORA-20104:

create_collection_from_query_b Error:ORA-01006: bind variable does not exist

My code is

DECLARE
l_names wwv_flow_global.vc_arr2;
l_values wwv_flow_global.vc_arr2;
l_names(1) := 'EXPENSE_FROM';
l_names(2) := 'EXPENSE_TO';

[code]....

View 1 Replies View Related

Application Express :: On Last Page Cannot Do INSERT With Session Variables?

Sep 9, 2013

I have made Horizontal Wizard Progress List over 3 pages.I also made those 3 pages with some simple text fields, checkboxes and so on.On the last page I did the INSERT Process (session variables P100_Date ect).It worked fine! But now I tried a different approach

On each of the 3 pages I made a "Form on a Table or View" and on each pageI hide some of the form. (the advantage of this situation is, that apex gives you a visaul hint about the null fields and so on).But on the last page I cant do the INSERT with the session variables.(I can do the INSERT without session variable, with static values)...

View 5 Replies View Related

SQL & PL/SQL :: Function That Returns A Table Type Inside A Package Body

Jul 26, 2011

CREATE OR REPLACE TYPE TEST_OBJ_TYPE IS OBJECT
(
TEST_ID NUMBER(9),
TEST_DESC VARCHAR(30)
)
/
CREATE OR REPLACE TYPE TEST_TABTYPE AS TABLE OF TEST_OBJ_TYPE
/
[code]....

I need to include the above function in a plsql package. How I can declare a object type and table type in a pks file? the syntax to include the above code in a .pks and .pkb file?

I got this code snippet online when I was looking for function that returns a table type. what exactly that Exception block does? delete the table when there is an exception, otherwise return the table type?

View 10 Replies View Related

SQL & PL/SQL :: Function Returning Top Value If Not Exists Then Next One?

Nov 20, 2010

how to write a function that returns top value if not exists then next top for combination of customer_id and hierarchy.For instance :

If I've got table

customer_id ,hierarchy, function_code
123 |1 | Z1
123 |2 |67
123 |3 |5B
678 |10 |S2
678 |11 |Z2
345 |2 |11

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.

View 9 Replies View Related

SQL & PL/SQL :: Optimizing Function Returning Integer?

Feb 5, 2012

I have the following function that I am using as a template for any function that executes a select statement and return a single value as an output.

The function is working but I wanted to take an expert opinion if it can be optimized.

CREATE OR REPLACE FUNCTION AFESD.F_AGR_GET_AGREEMENT_SERIAL
(I_NUMBER0 IN NUMBER, S_SUB_NUMBER VARCHAR2 DEFAULT NULL, I_TYPE_ID NUMBER)

[Code]....

In addition I want to use the parameter S_SUB_NUMBER that can be NULL and add it to the select statement of the cursor, but I dont know how to do that in one statement.

CURSOR C_AGREEMENT
IS
SELECT AGREEMENT_SERIAL
FROM VW_AGR_AGREEMENT
WHERE NUMBER0 = I_NUMBER0
AND TYPE_ID = I_TYPE_ID
-->and sub_number is null;
-->and sumb_number = s_sub_number

View 11 Replies View Related

Windows :: Returning REF Cursor From PL/SQL Function?

Apr 5, 2011

I've seen several code samples that show how to return a REFCURSOR from a Stored Function, but when I try it with C# it gives me allways WRONG NUMBER OF ARGUMENTS or somehing like that.

I presently don't have my code in here, but it is something like this:

cmd.Parameters.add ("parRefCursor", dbresult.RefCursor, direction.Result);

I'm being able to use it as a OUT parameter, but I would like to have it as a RETURN value from a Function.

View 4 Replies View Related

Function Not Returning Data (Desired Results)

Jul 14, 2010

I'm trying to debug this function to get the desired results. See attachment for the function code and the test data insert script.

----Create Test Table
CREATE TABLE VC_WORKINGDAYS
(
WK_ID number NUMBER(10,0),
WK_DATE DATE,
);

-- Insert test Data
INSERT INTO VC_WORKINGDAYS_1 VALUES (308, '25-MAR-11');
INSERT INTO VC_WORKINGDAYS_1 VALUES (316, '06-APR-11');
INSERT INTO VC_WORKINGDAYS_1 VALUES (324, '18-APR-11');
INSERT INTO VC_WORKINGDAYS_1 VALUES (332, '03-MAY-11');
INSERT INTO VC_WORKINGDAYS_1 VALUES (340, '13-MAY-11');
INSERT INTO VC_WORKINGDAYS_1 VALUES (348, '25-MAY-11');
INSERT INTO VC_WORKINGDAYS_1 VALUES (356, '06-JUN-11');
INSERT INTO VC_WORKINGDAYS_1 VALUES (364, '16-JUN-11');
INSERT INTO VC_WORKINGDAYS_1 VALUES (372, '28-JUN-11');
INSERT INTO VC_WORKINGDAYS_1 VALUES (380, '08-JUL-11');
INSERT INTO VC_WORKINGDAYS_1 VALUES (388, '20-JUL-11');
INSERT INTO VC_WORKINGDAYS_1 VALUES (396, '01-AUG-11');
INSERT INTO VC_WORKINGDAYS_1 VALUES (404, '11-AUG-11');

SQL
----- Result Should be WHY
SELECT (VC_CALC_WD_DATE(LAST_DAY(TRUNC(SYSDATE)),1)) FROM DUAL 14/JUL/10 15/JUL/10 is 1 working day from today
SELECT (VC_CALC_WD_DATE(LAST_DAY(TRUNC(SYSDATE)),2)) FROM DUAL 14/JUL/10 16/JUL/10 is 2 working days from today
SELECT (VC_CALC_WD_DATE(LAST_DAY(TRUNC(SYSDATE)),3)) FROM DUAL 14/JUL/10 19/JUL/10 is 3 working days from today

Attached File(s)

 create_Function.zip ( 6.39K )
Number of downloads: 1

 InsertData.txt ( 84.34K )
Number of downloads: 0

View 1 Replies View Related

SQL & PL/SQL :: Function Returning A Table Inside Where Clause?

Apr 5, 2010

DECLARE
cnt number(10);
BEGIN
SELECT COUNT(*) INTO CNT FROM TBL_ADDRESS WHERE ADDRESS_ZIP
IN (SELECT * FROM TABLE(MY_PACK.STR2TBL('46227')));
DBMS_OUTPUT.PUT_LINE (cnt);
END;

MY_PACK.STR2TBL() is a function which takes '|' delimited string, extracts values and returns a table of zipcodes. The function works fine and returns 46227 but the count returned is 0 instead of 280(count returned by replacing inner select with '46227').

View 22 Replies View Related

SQL & PL/SQL :: Returning Value Of Dynamic Select In Oracle Function?

Jul 20, 2011

I am trying to run a dynamic select statement form a function and return the result into a variable, everything goes fine but the return is always null!

CREATE TABLE AFESD.MAJOR_ACCOUNT
(
NUMBER0 NUMBER(2) NOT NULL,
SHORT_NAME CHAR(35 BYTE) NOT NULL,
FULL_NAME CHAR(50 BYTE)
)

--Actually any table can do

CREATE OR REPLACE FUNCTION F_GEN_SELECT_INT
(S_APP_USER IN VARCHAR2, I_MODULE_ID IN NUMBER, S_TABLE IN VARCHAR2, S_COLUMNS IN VARCHAR2)
RETURN NUMBER
AS
I_RETURN NUMBER;
S_SQL VARCHAR2(300);
--S_DB_ERROR VARCHAR2(100);

[code]....

B.S. I didnt delete the commented lines to have your review comments.

View 21 Replies View Related

SQL & PL/SQL :: Function Returning Table Of Dynamic Structure

Apr 24, 2013

I have a requirement to be coded like this:

A function to return pl/sql table(cant use ref cursor) whose columns varies every time it runs i.e,

means
type pl_tab_type is object(col1 varchar2(1000), col2 varchar2(1000))
type pl_tab is table of pl_tab_type

func f return pl_tab
as
...
end;

note : pl_tab_type will vary for each run of function f

i.e.,for example, pl_tab_type can be changed to as follows:

type pl_tab_type is object(col1 varchar2(1000), col2 varchar2(1000),col3 varchar2(1000))

how to return pl/sql table of dynamic type from func,

View 12 Replies View Related

SQL & PL/SQL :: Function Returning CLOB - Invalid Format

Jan 22, 2011

I have a problem when trying to create a PLSQL function based on an XML extraction query.

I have three dummy tables:

SQL> get create_address
1 create table ADDRESS
2 (
3 id NUMBER not null,
4 house_number NUMBER,
5 house_name VARCHAR2(20),
6 street_name VARCHAR2(30),

[code]....

And the following dummy data for these:

1 insert all
2 into ADDRESS (ID, HOUSE_NUMBER, HOUSE_NAME, STREET_NAME, CITY, COUNTY, POSTAREA, POSTSTREET)
3 values (1, 1, '', 'Tube Street', 'Norwich', 'Norfolk', 'NF12', '2DF')
4 into ADDRESS (ID, HOUSE_NUMBER, HOUSE_NAME, STREET_NAME, CITY, COUNTY, POSTAREA, POSTSTREET)
5 values (2, 5, '', 'Dave Street', 'Edlington', 'Kent', 'CT34', '8GH')
6 into ADDRESS (ID, HOUSE_NUMBER, HOUSE_NAME, STREET_NAME, CITY, COUNTY, POSTAREA, POSTSTREET)

[code]....

So far so good then. But, what I want to create is a function where I can pass in an id value and return the corresponding XML CLOB.

So I try, very simply, this:

SQL> get get_xml_data
1 create or replace function get_xml_data(p_id in number) return clob is
2 Result clob;
3 begin
4 select xmlroot(xmlelement("HomeData",

[code]....

And, alas, i'm greeted by this:

SQL> /
Warning: Function created with compilation errors.
SQL> sho err
Errors for FUNCTION GET_XML_DATA:
LINE/COL ERROR
-------- -----------------------------------------------------------------
4/5 PL/SQL: SQL Statement ignored
24/63 PL/SQL: ORA-00932: inconsistent datatypes: expected NUMBER got -
SQL>

I've tried to redo the query in several different ways but so far nothing.

View 2 Replies View Related

Application Express :: IR Report Value From Function Error

Apr 11, 2013

i have ir report and one column value coming from function,when open the IR report its giving error..

IR report code
SELECT CS_ID ,CS_NAME, Util_func(PASS_ID) as "ALERT_DAYS"   from "CSD_MASTERS" Function code
FUNCTION  Util_func(PASS_ID NUMBER) RETURN number
IS
ALERT_DAYS NUMBER:=0;
BEGIN
[code]........  

View 8 Replies View Related

Application Express :: How To Create Sentry-Function

Jul 18, 2013

I want to build a custom authentication scheme which combines the funcionality of of SSO and a custom authentication function.

1. If the HTTP Header Variable REMOTE_USER is set, this user should be a valid logged on user. (Single Sign On functionality)

2. If the HTTP Header Variable is not set, the LOGIN-Page should appear. (local user Administration)

3. The user/password combination from the login page should be validated by my own authentication function I think I have to create a sentry-Function, which is a combination of the sentry-functions which are used in the schemes "custom" and "HTTP Header Variable". I tried to find an implementation of these functions in the APEX_040200 database scheme, but without success.

View 5 Replies View Related

SQL & PL/SQL :: Email Query Results In Message Body To Multiple Recipients?

May 9, 2013

this is procedure to send email to multiple receipents

CREATE OR REPLACE PROCEDURE mail ( subject IN VARCHAR2,recievers VARCHAR2)
IS
sender VARCHAR2(30) := 'mailid';

[Code]...

i got procedure sucessfully created

execute mail('hi','mail id1,maildi2');

when i execute the procedure i get the following error

Error at line 1
ORA-29279: SMTP permanent error: 554 5.5.1 Error: no valid recipients
ORA-06512: at "SYS.UTL_SMTP", line 17
ORA-06512: at "SYS.UTL_SMTP", line 98
ORA-06512: at "SYS.UTL_SMTP", line 271
ORA-06512: at "SUPPLIER.MAIL", line 47
ORA-06512: at line 1

View 7 Replies View Related

Application Express :: Javascript Function For Tabular Form Changes?

Apr 12, 2013

I have a tabular form with a few columns. THey are ID, date1, date2 and task_name. The task_name is a drop down list of tasks. Upon selecting a specific task, I want the date1 and/or date2 columns to become read only (voided out) so users cannot enter in data. I am working with a tabular form, so I figured I need a javascript function to handle the logic and to call the function in the html elements of the column in the apex environment. This will need to happen dynamically (on click) before the page is submitted. I am more lost/confused on syntax. I know I will need to know the actual column name (coo1, coo2, something like that) of my columns that I will be refering to when I use javascript.

View 2 Replies View Related

Application Express :: How To Do Selectable Filtering Of Output From Table-function

Jun 26, 2013

I have a report which comes from a table-function.  This produces hundreds of lines of output which the user would like to be able to select and then export just the subset of lines.Looking at the Forum's (this article and this one) this seems possible if you are working with a table where you can re-query the original dataset with just a specific rowset required however as the table-function is generating output on the fly it is hard to rerun the query to reselect the same output for redisplay.  Also most of the reports are working with interactive reports - whilst this is just static output. Is there a way to redisplay the information which has already been shown in an filtered way with check boxes?Is there then a way to have hidden fields which are not shown when the check boxes are selected but which can be shown in the "filtered" view? I am using Apex 4.0 at the moment on an Oracle 10g instance.

View 0 Replies View Related

Application Express :: How To Add Delete Function To A Form With Report That Is Already Created

Apr 11, 2013

I am not familiar with form with report in APEX. I have a lot of forms with reports that was created before, but they have only create buttons. Now I need to add edit and delete buttons. I wish I do not have to recreate forms with reports. But when I tried to add delete function by comparing a form with delete button created by APEX, but it does not work. the delete button does not react at all.

setting is as follows:

button style: template based button
button template: Button
button type: normal
action: redirect to URL
execute validation: NO
URL target: javascript:apex.confirm(htmldb_delete_message,'DELETE');
database action: SQL delete action
condition type: value of item / column in expression1 is not null
expression1: P2172_ALIAS_ID

I also enable the delete in the process of :"Process Row of SOR_ALIAS"

If I set action of delete button as submit page, I can delete the row, but no standard popup warning,

View 2 Replies View Related

Application Express :: Image Not Displayed In Form With APEX Utility Function

Apr 18, 2013

I have just created the basic employee information form in which i upload the photograph of the employee. The photograph gets uploaded but it does not display properly. I have already referred the sample database application to display the image. Moreover, i have followed the same steps as it is used to display the product image in that application. Still i am unable to get result. I am getting following output:

<img src="apex_util.get_blob_file?a=35682&s=101496289174102&p=15&d=10639237623242912156&i=10639236703270912154&p_pk1=21&p_pk2=&p_ck=FCA12832591A1C706D76FDD589E551A2" />

View 11 Replies View Related

Application Express :: How To Call Function Behind The Button And Update Only Specific Record

Oct 3, 2012

1 - i want to ask few things as i m new to apex, i am using apex 4.1, and created 3 select list and a button in selecting of parameter,

1 select list : select area
2 select list: select product
3- select list - size of the product

i want to generate Ids for the following. for that i created query for INSERTING RECORD FROM ONE TABLE TO ANOTHER , generation the ids when button pressed "Generate" after selecting parameters,

Now where i call that QUERY on button ? because when i create button its gives me option to submit, defined dynamic action, etc, where i call the function name id_generation when button pressed?

2- second thing i created tabular " select user_id, product_name, product_type from product".

By default check box list are create delete submit button are created, first when i insert record it saves that was fine, e.g i entered 50 records and afterward i want to update only one record, e.g there is a record product name = box, if i change it to box small and click submit then it saves all the page means all 50 records,

I want to submit only that record that i changed, for that i use the logic that only those records should be updated which are checked but the user. how will i do this ?

View 4 Replies View Related

Application Express :: 4.2 Translate (Function And Global Variable Declaration) Data?

May 1, 2013

i 'm using APEX 4.2.1.00.08 and i 'm wondering if there is a way to translate "Function and Global Variable Declaration" textarea. Every other script textarea is available for translation, but not this.

I know that this is code is loaded on header but may contains important alert messages of global functions.

View 1 Replies View Related

Application Express :: Removing Text Messages Using Wwv_flow_api Or Multiple Delete Function?

Oct 8, 2012

I am currently using APEX 4.1 on oracle 11g XE.

By now I only know one way to delete text messages (globalization) and that is click them one-by-one and hitting the delete button.

To delete 100 messages this is really a pain, so I thought, there must be a way to multi-delete them, or just flush them out!

I searched all over the internet but I can't seem to find a way.

Is there a way to delete all text messages? For example by using wwv_flow_api or any other way?

View 0 Replies View Related

Application Express :: Dynamic Actions Call A Javascript Function On All Text Items

Feb 21, 2013

On a tabular form I have 50 columns each an input box , (basically 50 weeks of the year)

in these boxes I want to make them numbers only and max length 2

currently I have in the ELEMENT ATTRIBUTES for each column

OnFocus="javascript:this.maxLength=2"; onKeyPress="return numbersonly(this,event)";

( I have a function called numbers only in page 0 )

what I would like to do , to make it more maintainable is to remove all the calls in the element attributes of each column

and put it in 2 dynamic actions how would I go about this ?

I have tried using jquery selector of input:text to call javascript code on both events , Get focus and Key Press for every text box but its not working .

View 5 Replies View Related

Application Express :: BLOB Action - Implement File Upload And Download Function

Sep 11, 2013

In my project, I implement file's upload and download function by  "BLOB Support in Forms and Reports" of  official development document Advanced Programming Techniques When user click the BLOB column to download file, I want to trigger an action to update one table  for counting this file is downloaded one more times. But I can not find any "dynamic action" about this Blob column of Report.

View 1 Replies View Related

Simple Update Query Not Returning More Than One Row?

Sep 9, 2009

I've just started with the Oracle SQL and come from a heavy MS SQL background and I understand that here are some natural differences in the syntax but I'm stumped as to why the following sql represents a problem:

update MASTERMICODES t1
set t1.TEMPTA = ( select t2.TAFCODE
from TA_FEATURES t2
where t2.FCODE = t1.FCODE
)

It returns Error report:
SQL Error: ORA-01427: single-row subquery returns more than one row
01427. 00000 - "single-row subquery returns more than one row"
*Cause:
*Action:

I want it to return more than one row...in fact I want it to make on all rows that have the same fcode between tables.

View 2 Replies View Related

SQL & PL/SQL :: Single Return Sub Query Returning More Value

Aug 21, 2013

i am trying to update below statement that has multiple rows but giving the error like :

update test t
set (t.org_id) =
(select o.org_id
from organisation o inner join test t
on (o.name=t.full_name
or o.name=t.chart_name))

error:- single return sub query return more value.

how to write update join query base on multi[ple ow.

View 8 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved