Is it possible to run sql query against an oracle package? - sql

I have a query regarding a sql query that passes some data to an Oracle package. My sql query tries to cross against the data that is processed by this package, furthermore I visually validated that this package exists and I have access. But when executing the query, it returns me that there is no such package.
I leave the sql statement:
SELECT NVL(ROUND(SUM(MONTO_CUOTA *
DECODE(A.TIPO_IMPUTACION, 1, 1, 2, -1, 1) *
CONTROL_OPERAC.PCK_SERVICIO.OBTENER_VALOR_1(FECHA_VALOR_CUOTA,
TIPO_FONDO) / CASE
WHEN VINU_TIPO_MONEDA = 1 THEN
1
WHEN VINU_TIPO_MONEDA = 2 THEN
CONTROL_OPERAC.PCK_SERVICIO.OBTENER_VALOR_2(FECHA_IMPUTACION)
ELSE
1
END),
2),
0)
FROM TABLE(MOVIMIENTO.PCK_CART_PIPELINED.EXAMPLE(44682158,
1,
1,
NULL,
NULL,
NULL,
13-05-1981,
31-07-2020,
NULL)) A,
DATOSEXAM.MAPEO_CODIGOS B
WHERE A.ID_CODIGO_MVTO = B.ID_CODIGO_MVTO
AND B.TIPO_CUENTA = A.TIPO_CUENTA
AND B.CLASIFICACION = 'EXAMPLE'
AND A.ID_ADMINISTRADORA = 900;
The error message that I get is the following:
ORA-00904: "MOVIMIENTO"."PCK_CART_PIPELINED"."EXAMPLE": identificador no válido
00904. 00000 - "%s: invalid identifier"
*Cause:
*Action:
Error en la línea: 15, columna: 18
Is it possible to execute this query when being against a package?
Thank you very much in advance, I will be attentive to your answers.
Regards!

Related

sybase script don't understand trouble

I 'm not a regular of Sybase ASE.
Tring to make a script to add line into a tempory table.
sybase version 12.5.4
BEGIN
declare and init variable
--boucle
select * into #parTemp from Parution where 1=2
WHILE #dateCourante <= #dateFin
BEGIN
select #dpart1=datepart(mm,#dateCourante)
select #dpart2=datepart(dd,#dateCourante)
select #dpart3=datepart(dw,#dateCourante)
--si on est pas le 1er mai
if #dpart1 <> 5 AND #dpart2 <> 1
begin
--id parution
select #idPar = #idPar + 1
select #idParChaine = convert(varchar(10),#idPar)
--num parution
select #numPar = #numPar + 1
select #numParChaine = convert(varchar(20),#numPar)
--prix du jour courant
if datepart(dw,#dateCourante)=6
select #prixCourant = #prixVen
else
if datepart(dw,#dateCourante)=1
select #prixCourant = #prixDim
else
select #prixCourant = #prix
end
end
insert into #parTemp values (#idParChaine,#dateCourante,#numParChaine,#nbPagination,#prixCourant,#poids,#parCompt,#parOJD,#resVal)
end
select #dateCourante = dateadd(dd,1,#dateCourante)
END
END
Errors i get :
Error code 156, SQL state ZZZZZ: Incorrect syntax near the keyword 'WHILE'.
Error code 156, SQL state ZZZZZ: Incorrect syntax near the keyword 'end.
Error code 156, SQL state ZZZZZ: Incorrect syntax near the keyword 'End'.
i really don't understand, thank for help.
Pierre

weird query behavior oracle sql - convert text to number

oracle query This works
select *
from (
select to_number(substr(app_cluster,6,2), '99') as b
from xtern_app_info
WHERE app_cluster IS NOT NULL
AND APP_CLUSTER <> 'CLUSTER'
);
but when adding 'where b > 2' makes an error, why?
select *
from (
select to_number(substr(app_cluster,6,2), '99') as b
from xtern_app_info
WHERE app_cluster IS NOT NULL
AND APP_CLUSTER <> 'CLUSTER'
) where b > 2;
ORA-29913: error in executing ODCIEXTTABLEFETCH callout
ORA-01722: invalid number
29913. 00000 - "error in executing %s callout"
*Cause: The execution of the specified callout caused an error.
*Action: Examine the error messages take appropriate action.

`FOR UPDATE` breaks batch execution in HANA

HANA 102.05 fails to execute the following code:
CREATE TABLE ATABLE( f INT );
CREATE PROCEDURE TestProc()
AS
BEGIN
SELECT f FROM ATABLE
FOR UPDATE; -- Without FOR UPDATE it works
END;
SELECT 'Hello' FROM DUMMY;
complaining that:
SAP DBTech JDBC: [257]: sql syntax error: incorrect syntax near "SELECT": line 8 col 2 (at pos 124)
which points outside the proceudure, at SELECT 'Hello'. The procedure itself compiles without error. The entire script completes successfully if I remove the FOR UPDATE directive. What is wrong with the original?
Update
When I execute the same query from hdbsql.exe I get:
0 rows affected (overall time 26,076 msec; server time 6518 usec)
* 257: sql syntax error: line 5 col 9 (at pos 71) SQLSTATE: HY000
* 257: sql syntax error: incorrect syntax near "END": line 2 col 1 (at pos 32) SQLSTATE: HY000
'Hello'
"Hello"
1 row selected (overall time 4644 usec; server time 143 usec)

SQL Error near the word 'go'

Why does SQL Server report that this statement isn't correct?
use DIGITECH
go
select *
from kunde as k
left join adresse as a on k.FK_AdID = a.AdID
where Name = 'Dirk'
go
SQL displays this error (in German):
Meldung 102, Ebene 15, Status 1, Zeile 14
Falsche Syntax in der Nähe von 'go'.
Meldung 102, Ebene 15, Status 1, Zeile 14
Falsche Syntax in der Nähe von 'go'.
Translated to english:
Msg 102 , Level 15 , State 1, Line 14
Incorrect syntax near 'go' .
Msg 102 , Level 15 , State 1, Line 14
Incorrect syntax near 'go' .
As other have pointed out, GO is the default batch delimiter for tools like Management Studio or sqlcmd. SQL Server does not understand GO, the tools use it to separate batches and send individual batches to SQL Server. You probably took an entire .sql file and executed in your app.
You can use a library like DbUtilSqlCmd which understands the sqlcmd delimiters (GO), and other sqlcmd specific syntax like :setvar, and execute your .sql file through it.
Can you specify the database in the query and avoid the go statements? For example:
select * from DIGITECH.dbo.kunde as k
left join DIGITECH.dbo.adresse as a
on k.FK_AdID = a.AdID
where Name = 'Dirk'

Oracle , when merge, show " invalid identifier"

MERGE INTO EP_PR
using(
select
SYSDATE AS CREATION_TIME_1,
1 AS STATUS_1,
0 AS DELETED_1,
SYSDATE AS LAST_MOD_TIME_1,
0 AS EP_STATUS_1,
SYSDATE AS EP_ISSUE_DATE_1,
CASE WHEN LENGTH(EKORG)<2 THEN 'UMC1' ELSE EKORG END AS EP_PURORG_1,
EKGRP AS EP_PURGRP_1
from ZEPT02
Where proc_flag='N'
) TABLE1
ON
(
TABLE1.EP_PR_NO_1=EP_PR.EP_PR_NO
)
WHEN MATCHED
THEN UPDATE SET
EP_PR.CREATION_TIME=TABLE1.CREATION_TIME_1,
EP_PR.STATUS=TABLE1.STATUS_1,
EP_PR.DELETED=TABLE1.DELETED_1,
EP_PR.LAST_MOD_TIME=TABLE1.LAST_MOD_TIME_1,
EP_PR.EP_STATUS=TABLE1.EP_STATUS_1,
EP_PR.EP_ISSUE_DATE=TABLE1.EP_ISSUE_DATE_1,
EP_PR.EP_PURORG=TABLE1.EP_PURORG_1,
EP_PR.EP_PURGRP=TABLE1.EP_PURGRP_1;
It shows errors that
SQL error: ORA-00904: "TABLE1"."EP_PR_NO_1": invalid identifier
00904. 00000 - "%s: invalid identifier"
*Cause:
*Action:
I'm trying to google it,
but my on clause "TABLE1"."EP_PR_NO_1" didn't appear at the merge column,
where did it wrong?
Thanks!
You haven't defined TABLE1.EP_PER_NO_1 anywhere, which is exactly what the Oracle error is telling you.