Inheritance with oracle objects - oracle

I try to implement inheritance with Oracle Objects :
CREATE OR REPLACE TYPE ENREG_320_BASE AS OBJECT ( .....) NOT FINAL
CREATE OR REPLACE TYPE ENREG_320_03 AS OBJECT UNDER ENREG_320_BASE( .....) FINAL
I have an error :
Error: ORA-06550: line 1, column 29: PLS-00103: Encountered the symbol
"UNDER" when expecting one of the following:
( not external JAVA_ BOUND_ The symbol "(" was substituted for
"UNDER" to continue. ORA-06550: line 2, column 17: PLS-00103:
Encountered the symbol "VARCHAR2" when expecting one of the following:
. ( ) , * # % & | = - + < / > at in is mod remainder not range
rem => .. <> or != or ~= >= <= <> and or like
LIKE2_ LIKE4_ LIKE ORA-06550: line 3, column 27: PLS-00103:
Encountered the symbol "VARCHAR2" when expecting one of the following:
Probably there is something I do wrong (first time trying inheritance in PLSQL). Can you help ?
PS : I work with Oracle 10
Thank you

We don't need AS OBJECT when creating sub-types. It's implied by the UNDER keyword.
You should bookmark the documentation in your browser. It's great for answrering questions like this. Find it here.

Related

SQLSTATE[42883]: Undefined function: 7 ERROR: operator does not exist: double precision > interval

So I'm using Laravel with GraphQL and PostgreSQL database.
My query is very long, but more specifically this line
selectRaw('(CASE
WHEN (COALESCE(((NULLIF((project_members.hourly_rate - last_known_user_costs.cost), 0)/NULLIF(project_members.hourly_rate, 0)) * 100),0) > (
SELECT value :: INTERVAL FROM "configuration" WHERE "key" = \'Gross Margin Per Resource Yellow\'
)) THEN \'red\'
WHEN (COALESCE(((NULLIF((project_members.hourly_rate - last_known_user_costs.cost), 0)/NULLIF(project_members.hourly_rate, 0)) * 100),0) > (
SELECT value :: INTERVAL FROM "configuration" WHERE "key" = \'Gross Margin Per Resource Green\'
)) THEN \'green\'
ELSE \'red\'
END) AS status')
when added, throws the following error:
SQLSTATE[42883]: Undefined function: 7 ERROR: operator does not exist: double precision > interval\nLINE 2: ...t), 0)/NULLIF(project_members.hourly_rate, 0)) * 100),0) > (\n ^\nHINT: No operator matches the given name and argument types. You might need to add explicit type casts.
I don't know if I'm writing the sentence properly

'=' expected near var_y

I have this code:
function var_leafdrop(var_inc, var_restpos)
If var_y >= var_restpos then
var_y = var_restpos
else
var_y = var_y + var_inc
end
return var_y
end
I get error:
error 18: '=' expected near 'var_y'
18 being the line:
If var_y >= var_restpos then
I've tried:
Changing the variable name
Changing its declaration
Removing the if then block
Moving the entire function to the beginning of the script file
This is using the built in script editor for Watchmaker.
I can't see any error!? I just don't get it. Is this some dumb idiosyncrasy with Watchmaker...?
As mentioned in the comments, Lua is case sensitive.
So use if instead of If.

I Have 2 1064 SQL Errors And Can Not Figure Them Out

This code worked good on ph 5.3. My server got upgraded to php5.6 and now the code no longer works.
Here is the two statements.
$sql = "UPDATE " . FORUM_TOUR_TABLE . "
SET page_subject = '$subject', page_text = '$message', page_access = $page_access
WHERE page_id = $id";
It says :
`SQL Error : 1064 Syntax error near 'WHERE page_id = 1' at line 3
UPDATE SET phpbb_forum_tour page_subject = ' Welcome To The Tower' , page_text = ' Update me please ' = WHERE page_access page_id = 1
Line : 172
File: admin_forum_tour.php`
That happens when I try to update a post.
When I try to add a new post using this code:
$sql = "INSERT INTO " . FORUM_TOUR_TABLE . " (page_id, page_subject, page_text, page_sort, bbcode_uid, page_access)
VALUES ($id, '$subject', '$message', $page, '$bbcode_uid', $page_access)";
This gives me this:
`SQL Error : 1064 Syntax error near ')' at line 2
INSERT INTO phpbb_forum_tour ( page_id , page_subject , page_text , page_sort , bbcode_uid , page_access ) VALUES (3, '2 Word Rule ', ' Hello World I am here ', 30 , ' f4e1be18dc ' )
Line : 198
File: admin_forum_tour.php`
I 100% apologize for asking this as I am more than sure it has been beat to death. I have been searching for a couple hours now and have all but given up. I had it working once but was told I opened my self up to injection. I am not a pro coder. I get lucky sometimes and make things work. I am sure these errors and code is basic to most but I am still learning.
Thanks for helping and understanding my "newbieness".

Expected parenthesis errors gfortran

I am trying to compile some fortran code using gfortran v.4.8.2.
When I compile, I get the following errors:
ant_driver.f90:185.72:
if (model%geometry%topg(ew,ns)-model%climate%eus(ew,ns)
1
Error: Syntax error in IF-expression at (1)
ant_driver.f90:187.119:
ry%thck(ew,ns) = -rhoo/rhoi * (model%geometry%topg(ew,ns)- model%climate%eus(ew,
1
Error: Expected a right parenthesis in expression at (1)
ant_driver.f90:188.27:
endif
1
Error: Expecting END DO statement at (1)
ant_driver.f90:248.82:
odel%geometry%usrf(ew,ns) = - (model%geometry%topg(ew,ns)-model%climate%eus(ew,
1
Error: Expected a right parenthesis in expression at (1)
ant_driver.f90:260.107:
model%geometry%usrf(ew,ns) - (model%geometry%topg(ew,ns)-model%climate%eus(ew,
1
Error: Expected a right parenthesis in expression at (1)
ant_driver.f90:174.30:
call glide_set_eus(model,eus)
1
Error: Rank mismatch in argument 'inarray' at (1) (scalar and rank-2)
The errors relate to the following lines of code:
185-188:
if (model%geometry%topg(ew,ns)-model%climate%eus(ew,ns) < 0 .and. model%geometry%thck(ew,ns) == 0 .and. &
mask(ew,ns) == 1) then
model%geometry%thck(ew,ns) = -rhoo/rhoi * (model%geometry%topg(ew,ns)-model%climate%eus(ew,ns))
endif
248:
model%geometry%usrf(ew,ns) = - (model%geometry%topg(ew,ns)-model%climate%eus(ew,ns)) * rhoo/rhoi &
+ (model%geometry%topg(ew,ns)-model%climate%eus(ew,ns))
260:
model%geometry%thck(ew,ns) = model%geometry%usrf(ew,ns) - (model%geometry%topg(ew,ns)-model%climate%eus(ew,ns))
174:
call glide_set_eus(model,eus)
Any help much appreciated. Thank you for your time.
Your errors are due to line truncation. For fixed-form Fortran a line length of 72 characters is specified and for free-form Fortran it should be 132 characters. You source should be interpreted as free-form due to the .f90 extension but you can force free-form in gfortran with -ffree-form. You can also alter the maximum line lengths in fixed- and free-form source with the options -ffixed-line-length-n and -ffree-line-length-n respectively, where n is the number of characters and values of 0 or none mean unlimited line length.

perl data not insert into oracle db

Hi I need to export these key, values , i m geeting while export, please share your thoughts,
my data file like this
Oct 1 06:25:45 github.com: { "pid":14428, "ppid":14397, "program":"upload-pack", "git_dir":"/data/repo/testorg/testrepo.git", "cmdline":"git-upload-pack --stateless-rpc .", "repo_name":"testrepo", "hostname":"github.com", "pusher":"testuserusha", "real_ip":"192.168.1.", "user_agent":"git/1.7.0", "transaction_id":"c0124fc145ffgwss677", "frontend":"github.com", "frontend_pid":20470, "frontend_ppid":20029, "repo_id":1355, "repo_public":true, "repo_guest_branches_enabled":false, "repo_config":"{}", "user_id":7068, "user_login":"testuser", "user_operator_mode":false, "pgroup":"13428", "status":"create_pack_file", "features":"", "cloning":true, "uploaded_bytes":4223321, "uploaded_bytes_rate":2929, "uploaded_bytes_last":1412222qq556 }
Oct 2 06:35:45 github.com github_audit: {"actor_ip":"127.0.0.1","note":"From Git","user":"testuser","user_id":null,"actor":"testuser","actor_id":null,"org_id":null,"action":"user.failed_login","created_at":141225644589,"data":{"actor_location":{"location":{"lat":null,"lon":null}}}}
Oct 2 06:40:45 github.com github_audit: {"actor_ip":"127.0.0.1","note":"From Git","user":"Username for 'https","user_id":null,"actor":"Username for 'https","actor_id":null,"org_id":null,"action":"user.failed_login","created_at":1412256464790,"data":{"actor_location":{"location":{"lat":null,"lon":null}}}}
i m not able to add full code here
my #values = values %hash;
my $dbh = DBI->connect("DBI:Oracle:host=$host;port=1500;SID=$sid",$user,$passwd);
my $sth = $dbh->prepare("INSERT INTO AUDIT_TABLE(id, value) VALUES (?,?);");
$sth->execute_array({},\#keys, \#values);
output
VALUE:
DBD::Oracle::st execute_array failed: ORA-00911: invalid character (DBD ERROR: error possibly near <*> indicator at char 60 in 'INSERT INTO AUDIT_TABLE(id, value) VALUES (:p1,:p2)<*>;') [for Statement "INSERT INTO AUDIT_TABLE(id, value) VALUES (?,?);"] at 1.pl line 43, <IN> line 1.
I've used this code
my #values = #hash{qw(id value)};
my $dbh = DBI->connect("DBI:Oracle:host=$host;port=1521;SID=$sid",$user,$passwd);
my $sth = $dbh->prepare("INSERT INTO AUDIT_TABLE(id, value) VALUES (?,?)");
$sth->execute_array({},\#keys, \#values);
I am getting this error
DBD::Oracle::st execute_array failed: ORA-00911: invalid character (DBD ERROR: error possibly near <*> indicator at char 60 in 'INSERT INTO GITHUB_AUDIT_HISTORY(id, value) VALUES (:p1,:p2)<*>;') [for Statement "INSERT INTO AUDIT_TABLE(id, value) VALUES (?,?);"] at 1.pl line 44, <IN> line 1.
It's the semicolon, it must be this:
my $sth = $dbh->prepare("INSERT INTO GITHUB_AUDIT_HISTORY(id, value) VALUES (?,?)");
The problem is the semicolon terminating your statement. This isn't valid.
Semicolons at the end of SQL queries are a feature of SQL editors/command line utilities (e.g. SQL*Plus), not the database itself. They can only be sent to the server as part of a compound statement (e.g. BEGIN...END or creating a procedure).

Resources