Passing a list of sdo_geometry SQL through a table of type sdo_geometry
Hello
I have a function that is defined using the following as an input parameter setting:
create or replace type t_sdo_geometries
as the table of sdo_geometry;
/
and:
function make_geometry
(
p_points t_sdo_geometries
)
return sdo_geometry
is
If I go, sdo_geonetry with a comma separated values it works fine:
Select
make_geometry
(
p_points = > t_sdo_geometries
(
sdo_geometry (2001, 32774, SDO_POINT (1, 1, null), null, null);
sdo_geometry (2001, 32774, SDO_POINT (2, 2, null), null, null);
sdo_geometry (2001, 32774, SDO_POINT (3, 3, null), null, null);
sdo_geometry (2001, 32774, SDO_POINT (4, 4, null), null, null)
)
) as geom
Of
Double;
But how can I use this same function but with a SELECT for sdo-geometry insead of values in a list explicit input?
Example:
Select
make_geometry
(
p_points = > t_sdo_geometries
(
Select a.geom from my_table a
)
) as geom
Of
Double;
I need to create another function?
Thanks in advance for any advice and indication.
Kind regards.
Here a complete example with CAST MULTISET wrote @PhilHerring and with a CAST of COLLECT using the simplest possible function make_geometry:
CREATE OR REPLACE TYPE t_sdo_geometries AS TABLE OF MDSYS.sdo_geometry; CREATE OR REPLACE FUNCTION make_geometry (p_points t_sdo_geometries) RETURN t_sdo_geometries IS BEGIN RETURN p_points; END; SELECT make_geometry ( t_sdo_geometries ( sdo_geometry(2001, 32774, sdo_point_type(1, 1, null), null, null), sdo_geometry(2001, 32774, sdo_point_type(2, 2, null), null, null), sdo_geometry(2001, 32774, sdo_point_type(3, 3, null), null, null), sdo_geometry(2001, 32774, sdo_point_type(4, 4, null), null, null))) AS geom FROM DUAL; WITH geoms(pcol) AS (SELECT sdo_geometry(2001, 32774, sdo_point_type(1, 1, null), null, null) FROM dual UNION ALL SELECT sdo_geometry(2001, 32774, sdo_point_type(2, 2, null), null, null) FROM dual UNION ALL SELECT sdo_geometry(2001, 32774, sdo_point_type(3, 3, null), null, null) FROM dual UNION ALL SELECT sdo_geometry(2001, 32774, sdo_point_type(4, 4, null), null, null) FROM dual) SELECT make_geometry(cast(multiset(select pcol from geoms a) as t_sdo_geometries)) FROM dual; WITH geoms(pcol) AS (SELECT sdo_geometry(2001, 32774, sdo_point_type(1, 1, null), null, null) FROM dual UNION ALL SELECT sdo_geometry(2001, 32774, sdo_point_type(2, 2, null), null, null) FROM dual UNION ALL SELECT sdo_geometry(2001, 32774, sdo_point_type(3, 3, null), null, null) FROM dual UNION ALL SELECT sdo_geometry(2001, 32774, sdo_point_type(4, 4, null), null, null) FROM dual) SELECT make_geometry(cast(collect(pcol) as t_sdo_geometries)) FROM geoms;
Hope that helps
_jum
Tags: Database
Similar Questions
-
How to pass a list as a bind variable in SQL Developer?
How can I pass a list as a bind variable in SQL Developer?
The following query in SQL Developer so work I put ": prmRegionID = 2.
SELECT COUNTRY_ID,
COUNTRY_NAME
OF HUMAN RESOURCES. COUNTRY
WHERE IN REGION_ID (: prmRegionID);
The problem is that I can't find how to set ": prmRegionID = 2, 3.
I know that I can replace ": prmRegionID" by a proxy '& prmRegionID '. The above query will work well with"& prmRegionID = 2" and with "& prmRegionID = 2, 3". "
But with this solution, I lost all the benefit of the use of bound variables (analysis hard against soft parse, possibility of SQL injection, etc.).
I'm learning how to do this in SQL, as well as the use of UDT in this thread: How to move a list as a bind variable?
But with this solution, I've lost nice SQL Developer user interface. In SQL developer, it is easy to test a query using the standard binding variable. When we start the application, a pop up asking for a value of the variable binding.
With the UDT, the interface request always variable binding standard. You have an idea on how I can get a variable string binding (such as 1, 2, 10) in a set of NUMBER or VARCHAR2? This way I would be able to launch a standard query in SQL Developer to test my application.
Can someone tell me what is the best approach to this?
Thank you in advance,
MBHi Blais,
Thank you for trying the SQL and PL/SQL instance before coming here - it was definitely the right approach, and you've got some very good suggestions there. Your needs for a invite only bind to the value in the clause list, I think I have a possible solution. I'll introduce you to a list of characters, so you'll have to tweak it for other types of data. First, add the following to your schema:
create or replace TYPE bind_tab_typ AS TABLE OF VARCHAR2(4000); create or replace FUNCTION comma_to_table(iv_raw IN VARCHAR2) RETURN bind_tab_typ PIPELINED IS ltab_lname dbms_utility.lname_array; ln_len BINARY_INTEGER; BEGIN dbms_utility.comma_to_table(list => iv_raw ,tablen => ln_len ,tab => ltab_lname); FOR i IN 1 .. ln_len LOOP PIPE ROW (ltab_lname(i)); END LOOP; END;
Now you can write a query, say for scott.dept, as follows, and have executed statement ask the value list in the clause as a single binding variable:
select * from dept where dname in ( select * from table( comma_to_table( :BNDS )) );
When you are prompted, provide the list of values separated by a single comma without any extra spaces.
I don't know if the Varchar2 (4000) really needs to be which is great. I use it because that's what dbms_utility.lname_array uses.
Kind regards
Gary
SQL development team -
Pass a list of values to a pl/sql function
I would like to pass a list of values to a pl/sql function where the list will be used in an IN clause. Ideally, I would like to do the following:
CREATE or REPLACE FUNCTION (dept_list in varchar2)
Start
Select... where dept in (dept_list);
use: process_list ('7730,7735,7740,7745');
I can't find an example to do based on pl/sql, but it seems feasible.
Is there a way to do this?user12088323 wrote:
I would like to pass a list of values to a pl/sql function where the list will be used in an IN clause.
use: process_list ('7730,7735,7740,7745');
The first thing is that you need an appropriate data type for storing a list of numbers. A unique value that look you like a list of numbers, is not actually a list of numbers but a single character value.
This example uses the built in odcinumberlist data type in a procedure, you can do the same in function
Re: Pass an array to an Oracle stored procedure
If you have an older version of the database, you may need to create your own type with the same definition of odcinumberlist.
-
Component sql through shell script
How to call a sql through UNIX shell script file?Rahul India wrote:
export ORACLE_HOME=$ORACLE_BASE/product/10g cd $ORACLE_HOME set `sqlplus -s
/ < THIS SCRIPT IS OK?
You will also need to set ORACLE_SID
And I don't know why everyone puts the reference to sqlplus context of a 'set' assessment, nor why they put the reference to Scripture in a redirected input stream. What you need is
sqlplus -s user/password @r_100.sql
And to make sure the environment is set correctly:
export ORACLE_SID=whatever export ORAENV_ASK=NO . oraenv unset ORAENV_ASK=NO sqlplus -s user/password @r_100.sql
-
Run SQL through batch file, with parameters
Hi all
I run SQL through Batch files before, but I am a little confused with the execution of the sql with parameters. For example, if I have a named sql file:
I can run this problem normally, but including the substitution variables, as in the batch (.bat) file called Execute_insert.cmd is a bit annoying... I played a little with it and cannot operate.insert.sql Insert into TableA select * from TableB where service_dt >= '&&x_start_dt' and service_dt <= '&&x_end_dt';
Any help would be appreciated.
Thank you
EdChange your insert.sql to something more like:
Insert into TableA select * from TableB where service_dt >= TO_DATE('&1', 'format mask') and service_dt <= TO_DATE('&2', 'format mask');
Then, would you call it:
sqlplus user/password @insert.sql 01-oct-2012 31-oct-2012
John
-
I get currently getting an error when I try and insert into a table of a different pattern of my stored procedure:
Error (20.22): PL/SQL: ORA-00942: table or view does not exist
I am explicitly calling the table with the name of the schema that is infront
INSERT INTO SAPSR3. ZTREC_NAME_TYPE
(
MASTER_ID,
NAME_TYPE,
FAMILY_NAME,
FIRST NAME,
MIDDLE_NAME,
TITLE
)
VALUES
(
In_MasterID,
In_NameType,
In_FamilyName,
In_FirstName,
In_MiddleName,
In_Title
);
Only, I get this error when I try to compile my stored procedure. If I try this insert not within a stored procedure (for example, an empty script) it works perfectly.
Can someone tell me what Im doing wrong?
Thank you.Hello
Looks like you (the owner of the procedure) have privileges on that table only through a role.
Roles do not count in the stored procedures created with AUTHID OWNER (which is the default).Or the other
(1) user SAPSR3 have the privileges needed directly at you (or public), or
(2) change the procedure so that it runs with the privileges of the caller, adding AUTHID CURRENT_USER after the list of arguments, but before the keyword IS (AS os) like this:CREATE OR REPLACE PROCEDURE foo ( x IN NUMBER ) AUTHID CURRENT_USER IS ...
-
Hi all
11.2.0.3.10
AIX6
I was installing store_procedures on our PROD several times, and they are successful. This stored_procedures are created by developers and once tested on DEV & UAT, they are transferred to the PROD through me.
But this time I install a new SP, but I got error > Error (301,28): PL/SQL: ORA-00942: table or view does not exist
Even if the synonym. The owner of the schema of the SP has grant select on the table and synonym of created. Why not MS can see this synonym?
Is there something that I missed?
Help, please... I'm going crazy
Thank you all,
MK
Since there is only one user in your role, so I'll suggest to directly grant you the user rather than role - it's the easiest and simplest account according to your needs. The roles are best used to organize all of the users. If ever it is necessary to use roles (i.e. multiple users/schemas in a role) then, I think, you can play with AUTHID clause creating blocks.
-
Loading data from SQL to Essbase table
Hello
I'm loading data from SQL to Essbase table by using a rules file. Number of rows in the source table is 7 million. I use the SUNOPSIS MEMORY ENGINE as area transit, LKM SQL for SQL and SQL IKM for Hyperion Essbase (DATA).
Question:
1 can I not use any other LKM as MSSQL for MSSQL (PCBS) to load data to the staging instead of LKM SQL for SQL? What I have to change the transit area then? Loading data using LKM SQL for SQL seems quite slow.
2 it is mandatory to use LKM SQL for SQL, can someone please tell me what I can change to make this quick support parameters?
3. is it compulsory to use the SUNOPSIS MEMORY engine loading data from SQL server to Essbase?
Thank you...
(1) Yes, I highly recommend watching using a KM which uses native as database technology these will usually be more efficient than the generic (like LKM SQL for SQL) KM especially when large volumes of data are involved. Your staging will change depends on where you organize data for example if you are using a SQL server specific KM as - MSSQL for MSSQL (PCBS) - you must have a lay-by available on a MSSQL database and have access to the utility of PCBS.
(2) it is not mandatory to use this KM you can use a KMs supported by your database technology
(3) it is absolutely not obligatory to use the SUNOPSIS MEMORY engine. This should only be used when you have relatively small amounts of data, as well as all the processes in memory, or in the case where you have no other relational technology to perform the staging on. However, in your case to use wherever you are processesing these large volumes of data you should be staged on a physical such as SQL Server or Oracle database if they are available.
-
SQL with the Table using nested
Hello
Please help how to do that thing
I have a nested table of object type
create or replace type a1 as an object
(
a number,
b varchar2 (30),
VARCHAR2 (30) region
);
create table a1 type a1_array s;
declare
v_a1 a1;
v_a1_array a1_array:=a1_array();
Start
v_a1 = a1 (1, '1', 'AUS');
v_a1_array. EXTEND;
v_a1_array (1): = v_a1;
v_a1 = a1 (2, '2', 'AUS');
v_a1_array. EXTEND;
v_a1_array (2): = v_a1;
v_a1 = a1 (3, '3', 'NAM');
v_a1_array. EXTEND;
v_a1_array (3): = v_a1;
end;
Now, I v_a1_array have 3 row 2 with region AUS and the other with NAM region.
SQL help can I get lines only "AUS" and look in the TABLE OF TYPE v_a1_array (using Where clause and functions (Table))
Any help will be much appreciated. Please help. I have Oracle 11g
Thank you
I hope that you are looking for this.
pretend like your excel temp (with clause)
v_a2 - is a type of a1_array
SQL > select * from v version $;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11 g Enterprise Edition Release 11.2.0.2.0 - 64 bit Production
PL/SQL Release 11.2.0.2.0 - Production
CORE Production 11.2.0.2.0
AMT for Linux: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - ProductionSQL > DROP TYPE a1_array;
Type fell.
SQL > DROP TYPE a1;
Type fell.
SQL > CREATE or REPLACE TYPE a1 AS OBJECT
2 (a NUMBER, b VARCHAR2 (30), region VARCHAR2 (30));
3.Type of creation.
SQL > CREATE TYPE a1_array IS TABLE of a1;
2.Type of creation.
SQL > DECLARE
v_a1 2 a1_array;
3 v_a2 a1_array;
4 BEGIN
5 WITH temp
6 AS (SELECT 1 a, 1 b, "AUS" AS region FROM DUAL
7 UNION ALL
8. SELECT 2 AS a, 2 b, "AUS" AS region FROM DUAL
9 UNION ALL
10. SELECT 3 a, b '3', 'NAM' AS region OF DOUBLE)
11. SELECT a1 (x.a, x.b, x.region)
In BULK 12 COLLECT IN v_a1
Temp 13 x;
14
15 SELECT a1 (x.a, x.b, x.region)
In BULK 16 COLLECT IN v_a2
TABLE (v_a1) 17 x
18 WHERE x.region = 'NAM ';
19
20
21 FOR I IN 1... v_a2. COUNTY
22 LOOP
(23) DBMS_OUTPUT.put_line
24 v_a2 (i) .a | '-' || v_a2 (i) .b | '-' || v_a2 (i) .region);
25 END OF LOOP;
26 END;
27.
3-3-NAMPL/SQL procedure successfully completed.
SQL > spool off;
-
Is it possible to write code that loops through a table in a form? I am currently writing separate sections of code for each row in a table of five rows to validate the data entries.
Hello
It would be easier if your table contained a line that repeats with an initial count of five (defined in the binding of the object palette tab). This will change the XML that is generated, but assuming that it is not a problem your could loop so your table with the code;
lines of the var = this.resolveNodes ("Table1.Row1 [*]");
for (var i = 0; i)
{
currentRow var = rows.item (i);
.
.
.
}
If you don't need the lines of uniquely named then go I and the result of "this.resolveNodes("Table1.Row"+i)" in a function.
You back form... with only the first validation converted to the new approach.
https://Acrobat.com/#d=akb0 * Ptvdr3KSYN0VP * 7zA
Hope this gets you started.
Concerning
Bruce
-
Loop PHP through 2 tables of MySQL?
Manu chaps,
I have a bit of PHP code, that loops through a table MySQL (jobs) and displays all the records that were not complete. The code and the MySQL Query work fine.
I want to know is whether the query can be modified to perform a loop on 2 tables.
Here's my current query:
@mysql_select_db ($database_conndb2, $conndb2);
$query_rsJobs ="
SELECT
tbl_projects.projID,
tbl_projects.projtitle,
tbl_jobs. JobID,
tbl_jobs. FK_projid,
tbl_jobs. JobName,
tbl_jobs. FK_langid,
tbl_languaget.langtname,
tbl_jobs.jobpages,
tbl_jobs.jobshipped
Of
tbl_projects
JOIN IN-HOUSE
tbl_jobs
ON tbl_projects.projid = tbl_jobs. FK_projid
JOIN IN-HOUSE
tbl_languaget
ON tbl_languaget.langtid = tbl_jobs. FK_langid
WHERE
tbl_jobs.jobshipped =' no
ORDER BY
FK_projid ASC";
$rsJobs = mysql_query ($query_rsJobs, $conndb2) or die (mysql_error ());
$row_rsJobs = mysql_fetch_assoc ($rsJobs);
$totalRows_rsJobs = mysql_num_rows ($rsJobs);Here is my table that displays the results:
< table >
< b >
Title of the Document < td > < table >
Language < td > < table >
< Table > < td > pages
Edit < td > < table >
Delete < td > < table >
< /tr ><? PHP
$previousProject = ";
If ($totalRows_rsJobs > 0) {}
Show if recordset not empty
While ($row_rsJobs = {mysql_fetch_assoc ($rsJobs))}
If ($previousProject! = $row_rsJobs ['prices']) {}
for each project, see the project ID
? >< b >
< td > <? PHP echo $row_rsJobs ["PROJID']? > < table >
< /tr ><? PHP $previousProject = $row_rsJobs ["PROJID"]; } ? >
< b >
< td > < a href = "jobsheet_details.php? id = <?" PHP echo $row_rsJobs ["IDTravail"];? > & amp; proj = <? PHP echo $row_rsJobs ["PROJID'];? > "> <?" PHP echo $row_rsJobs ['jobname'];? > < /a > < table >
< td > <? PHP echo $row_rsJobs ["langtname"];? > < table >
< td > <? PHP echo $row_rsJobs ["jobpages"];? > < table >
< td > < a href = "jobsheet_edit.php? id = <?" PHP echo $row_rsJobs ["FK_projid"];? > & amp; job = <? PHP echo $row_rsJobs ["IDTravail"];? > "> edit < /a > < table >"
< td > < a href = "jobsheet_remove.php? id = <?" PHP echo $row_rsJobs ["FK_projid"];? > & amp; job = <? PHP echo $row_rsJobs ["IDTravail"];? > "> delete < /a > < table >"
< /tr ><? PHP} while ($row_rsJobs = mysql_fetch_assoc ($rsJobs));? >
<? PHP} / / show if recordset not empty? >< /table >
And finally, this is the query that I need to add to my current request to show the resutls of the two tables:
@mysql_select_db ($database_conndb2, $conndb2);
$query_rsJobTrans ="
SELECT
tbl_projects.projID,
tbl_projects.projtitle,
tbl_jobtransline. JobID,
tbl_jobtransline. FK_projid,
tbl_jobtransline,
tbl_jobtransline. FK_langid,
tbl_languaget.langtname,
tbl_jobtransline.jobpages,
tbl_jobtransline.jobshipped
Of
tbl_projects
JOIN IN-HOUSE
tbl_jobtransline
ON tbl_projects.projid = tbl_jobtransline. FK_projid
JOIN IN-HOUSE
tbl_languaget
ON tbl_languaget.langtid = tbl_jobtransline. FK_langid
WHERE
tbl_jobtransline.jobshipped =' no
ORDER BY
FK_projid ASC";
$rsJobTrans = mysql_query ($query_rsJobTrans, $conndb2) or die (mysql_error ());
$row_rsJobTrans = mysql_fetch_assoc ($rsJobTrans);
$totalRows_rsJobTrans = mysql_num_rows ($rsJobTrans);
? >
I don't know if it's possible and tried it myself but seem to get a little bit of mess, since both tables use a foreign key to the projects and language tables, any help would be most appreciated!Add tbl_jobtransline to the query and join the other two tables? What exactly is the problem?
-
Tree of SQL on multiple tables
Hi gurus,
I have a question about the trees of building sql on multiple tables.
It's the exit, I hope:
This is the situation: I have 4 table which can be forced to key foreign and all build toghether in a tree.0 - 10, 'Company Blue1', 0 -- 101, 'Part Blue1', 10 --- 1001, 'Accounting Blue', 101 ---- 10001, 'Hans Mueller', 1001 --- 1002, 'Special Problems Blue', 101 ---- 10002, 'Stephen Meyer', 1002 ---- 10003, 'Carlos Anceto', 1002 -- 102, 'Part Blue2', 10 --- 1003, 'Information Technology Blue', 102 ---- 10004, 'Tobias Tries', 1003 - 20, 'Company Red1', 0 -- 201, 'Part Red1', 20 --- 2001, 'Accounting Red', 201 ---- 20001, 'Carl Van Deser', 2001 ---- 20002, 'Geromel Boats', 2002 - 30, 'Company Green1', 0 -- 301, 'Part Green1', 30 --- 3001, 'Accounting Green', 301 ---- 30002, 'Peter Finnighan', 3001 --- 3003, 'Special Problems Green', 301 ---- 30001, 'Loui Van Ecke', 3003
The problem is that I do not know how in alle concate these values and using the connection by the clause that creates this treeTable1: tbl_company (c_id, company_name) Values: 10, 'Company Blue1' 20, 'Company Red1' 30, 'Company Green1' Table2: tbl_company_parts (cp_id, part_name, company_id) Values: 101, 'Part Blue1', 10 102, 'Part Blue2', 10 201, 'Part Red1',20 301, 'Part Green1',30 Table3: tbl_departments (d_id, dept_name, part_id) Values: 1, 'Accounting Blue', 101 2, 'Special Problems Blue', 101 3, 'Information Technology Blue', 102 4, 'Accounting Red',201 5, 'Accounting Green',301 6, 'Special Problems Green',301 Tablemployees (e_id, dept_name, department_id) Values: 1, 'Hans Mueller', 1 2, 'Stephen Meyer', 2 3, 'Carlos AncetoÄ, 2 4, 'Carl Van Deser',4 5, 'Geromel Boats', 4 6, 'Loui Van Ecke',5 7, 'Peter Finnighan',6 8, 'Tobias Tries',3
Hi Tobias,.
It was not exactly how id should be calculated, but this example you get:
SQL> create table tbl_company (c_id, company_name) 2 as 3 select 10, 'Company Blue1' from dual union all 4 select 20, 'Company Red1' from dual union all 5 select 30, 'Company Green1' from dual 6 / Table created. SQL> create table tbl_company_parts (cp_id, part_name, company_id) 2 as 3 select 101, 'Part Blue1', 10 from dual union all 4 select 102, 'Part Blue2', 10 from dual union all 5 select 201, 'Part Red1',20 from dual union all 6 select 301, 'Part Green1',30 from dual 7 / Table created. SQL> create table tbl_departments (d_id, dept_name, part_id) 2 as 3 select 1, 'Accounting Blue', 101 from dual union all 4 select 2, 'Special Problems Blue', 101 from dual union all 5 select 3, 'Information Technology Blue', 102 from dual union all 6 select 4, 'Accounting Red',201 from dual union all 7 select 5, 'Accounting Green',301 from dual union all 8 select 6, 'Special Problems Green',301 from dual 9 / Table created. SQL> create table tbl_employees (e_id, emp_name, department_id) 2 as 3 select 1, 'Hans Mueller', 1 from dual union all 4 select 2, 'Stephen Meyer', 2 from dual union all 5 select 3, 'Carlos Anceto', 2 from dual union all 6 select 4, 'Carl Van Deser',4 from dual union all 7 select 5, 'Geromel Boats', 4 from dual union all 8 select 6, 'Loui Van Ecke',5 from dual union all 9 select 7, 'Peter Finnighan',6 from dual union all 10 select 8, 'Tobias Tries',3 from dual 11 / Table created. SQL> select coalesce 2 ( case when e.department_id is null then null else 3 trunc(d.part_id,-2) * 100 + dense_rank() over (partition by d.part_id order by e.e_id) 4 end 5 , trunc(d.part_id,-2) * 10 + dense_rank() over (partition by d.part_id order by d.d_id) 6 , p.cp_id 7 , c.c_id 8 , 0 9 ) id 10 , coalesce 11 ( e.emp_name 12 , d.dept_name 13 , p.part_name 14 , c.company_name 15 ) name 16 , coalesce 17 ( trunc(d.part_id,-2) * 10 + dense_rank() over (partition by d.part_id order by d.d_id) 18 , d.part_id 19 , p.company_id 20 , case grouping(c.c_id) when 0 then 0 end 21 ) parent_id 22 from tbl_company c 23 , tbl_company_parts p 24 , tbl_departments d 25 , tbl_employees e 26 where c.c_id = p.company_id 27 and p.cp_id = d.part_id 28 and d.d_id = e.department_id 29 group by rollup 30 ( ( c.c_id,c.company_name) 31 , ( p.cp_id,p.part_name,p.company_id) 32 , ( d.d_id,d.dept_name,d.part_id) 33 , ( e.e_id,e.emp_name,e.department_id) 34 ) 35 order by c.c_id nulls first 36 , p.cp_id nulls first 37 , d.d_id nulls first 38 , e.e_id nulls first 39 / ID NAME PARENT_ID ---------- --------------------------------------------------------------------------------- ---------- 0 10 Company Blue1 0 101 Part Blue1 10 1001 Accounting Blue 1001 10001 Hans Mueller 1001 1002 Special Problems Blue 1002 10002 Stephen Meyer 1002 10003 Carlos Anceto 1002 102 Part Blue2 10 1001 Information Technology Blue 1001 10001 Tobias Tries 1001 20 Company Red1 0 201 Part Red1 20 2001 Accounting Red 2001 20001 Carl Van Deser 2001 20002 Geromel Boats 2001 30 Company Green1 0 301 Part Green1 30 3001 Accounting Green 3001 30001 Loui Van Ecke 3001 3002 Special Problems Green 3002 30002 Peter Finnighan 3002 22 rows selected.
Kind regards
Rob. -
Convert or map Typedonnees decimal Transact-SQL for Oracle Number data type?
MSSQL 2005
Oracle 10.2 g
In a MSSQL table, I have a column with the data type set on (decimal (1.0), null) with the values of line-1. (695 lines in total)
In the Oracle table, the proposed mapped column is a number data type. When I import data, I received 695 errors with the message "invalid value for the field. How to properly convert or map Decimal (MSSQL) Transact-SQL for Oracle Number data type for a negative value?
Thank you.How do you load data into Oracle? What tool or programming language you are using? Can you post something cause what you stated in your post should work, but there may be some ODBC, or other type of conversion factors to be taken into account.
> create table t1 (field1 number(1,0)); Table created. > insert into t1 values (-1); 1 row created. UT1 > select * from t1; FIELD1 ---------- -1
HTH - Mark D Powell.
-
table font PL/SQL: ORA-00902: invalid data type
I m is
PL/SQL: ORA-00902: invalid data type
error in
OPEN FOR PPymtCur
SELECT *.
TABLE (CAST (up_gap_tra_reports.myArray AS traArray));
in my up_gap_tra_reports package.
CREATE OR REPLACE PACKAGE GAPSDVEL.up_gap_tra_reports
AS
TraRecord RECORD TYPE IS
(
group1StudEnrol NUMBER (6.1).
group2StudEnrol NUMBER (6.1).
pymtAmt gap_payment.NET_AMT%TYPE
);
TYPE traArray IS TABLE OF THE traRecord;
myArray traArray: = traArray();
END up_gap_tra_reports;
I have alreay hv declared of type traArray.
pls help me solve this problem.Meghna wrote:
is it possible to use the collection pl/sql in SQL or refcur without creating it because I'm not able to create the type of database.The only way I know is function in pipeline:
create or replace package pkg1 is type traRecord is record( ename emp.ename%type, sal emp.sal%type ); TYPE traArray IS TABLE OF traRecord; function f1 return traArray pipelined; end; / create or replace package body pkg1 is function f1 return traArray pipelined is v_rec traRecord; begin v_rec.ename := 'Sam'; v_rec.sal := 1000; pipe row(v_rec); v_rec.ename := 'John'; v_rec.sal := 1500; pipe row(v_rec); v_rec.ename := 'Mary'; v_rec.sal := 2000; pipe row(v_rec); return; end; end; /
Now, you can:
SQL> select * from table(pkg1.f1) 2 / ENAME SAL ---------- ---------- Sam 1000 John 1500 Mary 2000 SQL>
Don't forget, it will create the generated system types:
SQL> select type_name from user_types 2 / TYPE_NAME ------------------------------ SYS_PLSQL_73305_9_1 SYS_PLSQL_73305_DUMMY_1 SYS_PLSQL_73305_34_1 SQL> desc SYS_PLSQL_73305_9_1 Name Null? Type ----------------------------------------- -------- ---------------------------- ENAME VARCHAR2(10) SAL NUMBER(7,2) SQL> desc SYS_PLSQL_73305_DUMMY_1 SYS_PLSQL_73305_DUMMY_1 TABLE OF NUMBER SQL> desc SYS_PLSQL_73305_34_1 SYS_PLSQL_73305_34_1 TABLE OF SYS_PLSQL_73305_9_1 Name Null? Type ----------------------------------------- -------- ---------------------------- ENAME VARCHAR2(10) SAL NUMBER(7,2) SQL>
SY.
-
Passing the value of the SQL query select list
Hello
In my application users have in their homepage to a region which has two simple things, a part of LIST SLECT lov function and a BUTTON
There is also another page which has a normal life to report which shows the employees.
Homepage the user can select certain number of Department in its 'SLECT-LIST' and click 'open '.
For example: If the user has selected a DEP_NUM_5 and click on the BUTTON it will be redirected to the page of a report and gets only showed the employees belonging to the Department 5.
The report page contains a simple SQL query, and I understand that somehow I must pass the value in the SELECT LIST, where I now have the '?
How can I do this, where should I start?
Of course I would really appreciate an example of code, if anyone has time to do a.
select "EMP_ID", "EMP_FORNAME", "EMP_SURNAME", "DEP_NUMBER" from EMP E where E.DEP_NUMBER = ????????
Hi Sozua,
1. create an item hidden on the page where you have the report.
I say P2_DEPT_NO
2 assign to that in your sql query
select "EMP_ID", "EMP_FORNAME", "EMP_SURNAME", "DEP_NUMBER" from EMP E where E.DEP_NUMBER = :P2_DEPT_NO
below the area source ther is also an option
Elements of page to submit-> put this element in this.
for example;
Page to submit items: P2_DEPT_NO
3. change your button
Action: Redirecting to page of this application
Page: 2 / / assuming that page 2 is the report page
Place these items: P2_DEPT_NO
with these values: & P1_SELECT_LIST. assuming that selection list is on page 1
Hope this helps you,
Kind regards
Jitendra
Maybe you are looking for
-
I am not able to download apps for my iPhone on the App Store. He just 'waiting '. But never starts the download. I tried with wifi and mobile data. The two are not downloading the applications Can u find out what's wrong? I use iPhone 5s
-
On the 10.2 version my wallpaper shows on all websites in up and down
My desktop site appears at the top and at the bottom of all web pages.
-
(On the desktop) When I opened Firefox & follow the steps in the help (click on history, tools, etc.), these aren't active links. I'm clicking on a help screen; No actions are performed. Cache and cookies are not deleted.
-
Toshiba satellite click not available for use 10 2 battery
Hello, I have a problem with the second Says Toshiba satellite battery battery click 10 - ch. 2: it is not available for use. I did the bios 1.7 update. I have 1 fully charged battery for 10 hours.Does anyone have a solution?
-
File txt to ASCII binary (MATLAB equivalent?)
Hello I just started using LabView two days ago and need help with which is probably very basic. My goal is to take a .txt file that contains some message (letters, numbers, etc.) and convert it to a stream series of bits. In MATLAB, I would do it li